TEST M.
M - 50
CHAPTER 2: FUNCTIONS IN PYTHON
SECTION – A 5X1
=5
1) What is default parameter?
2) Can a function return multiple values in python?
3) If return statement is not used inside the function, then function will return?
4) Which of the following keywords marks the beginning of the function
block?
(a) func (b) define (c) def (d) function
5) What do you understand by flow of execution?
SECTION – B 9 X 3 = 45
1) What are keyword arguments? Also write advantage of keyword argument?
2) Consider the following function headers. Identify the correct statement: -
1) def correct(a=1,b=2,c): 2) def correct(a=1,b,c=3):
3) def correct(a=1,b=2,c=3): 4) def correct(a=1,b,c):
Also, State reason for each Option.
3) What will be the output of the following code?
a=1
def f():
a=10
print(a)
4) What are arguments? What are parameters? How are these two terms
different yet related? Give example.
5) What is the difference between local and global variables?
6) How many values a python function can return? Explain with an example?
7) Predict the output of the following code fragment?
def check(n1=1, n2=2):
n1=n1+n2
n2+=1
print(n1,n2)
check()
check(2,1)
check(3)
8) Write any two functions of random module and explain each function with
example?
9) What is the output of following code fragments?