Python Function MCQs

Question 1: What will be the output of the following code?

a=10
def myfunction():
    a=20
    return
print('a=',a)

Question 2: What is not true about formal and actual parameters?

Question 3: In Python, functions are

Question 4: Variable used inside a function become its

Question 5: What is true about the docstring of a function?

Question 6: In Python, 'global' is a:

Question 7: Does Python support type annotation?

Question 8: What is the output of the following code?

fn = lambda x : x * x
print(fn(4))

Question 9: What is the output of the following code?

>>>(lambda x: x*x)(5)

Question 10: What will be the output of the following code?

def display(x, y, z):
    print(x, y, z)

tpl = (1, 2, 3)
display(*tpl)