Function MCQ in Python – 3

Q1) What is a variable defined outside a function referred to as?

a) A global variable
b) A local variable
c) A static variable
d) An automatic variable

View Answer Answer:- a) A global variable

Q2) Which of the following items are present in the function header?

a) return value
b) function name
c) parameter list
d) Both function name and parameter list

View Answer Answer:- d) Both function name and parameter list

Q3) Does Lambda contains return statements?

a) False
b) True

View Answer Answer:- a) False

Q4) Lambda contains block of statements.

a) False
b) True

View Answer Answer:- a) False

Q5) Lambda is a statement.

a) True
b) False

View Answer Answer:- b) False

Q6) Which of the following function headers is correct?

a) def fun(x = 3, y = 5, z)
b) def fun(x = 3, y, z = 5)
c) def fun(x, y = 3, z = 5)
d) def fun(x, y, z = 5, i)

View Answer Answer:- c) def fun(x, y = 3, z = 5)

Q7) What is the output of the given below program?

def Hello():
   print('Know Program') 
Hello() 
Hello()

a) Know Program

b) Hello

c)
Know Program
Know Program

d)
Hello
Hello

View Answer Answer:- c)
Know Program
Know Program

Q8) Find the output of the given Python program?

def f(a, b, c): 
   return a + b * c
x = f(5, 3, 5)
print(x)

a) 13
b) 15
c) 20
d) 25

View Answer Answer:- c) 20

Q9) What is the output of the given below program?

def cube(a):
   return a * a * a     
a = cube(5)  
print(a)

a) 15
b) 25
c) 125
d) Error

View Answer Answer:- c) 125

Q10) What is the output of the given below program?

def printMax(x, y):
   if x > y:
      print(x)
   elif x == y:
      print('Equal')
   else:
      print(y)
printMax(5, 9)

a) 5
b) 9
c) Equal
d) None of these

View Answer Answer:- b) 9

Q11) Find the output of the given Python program?

def say(message, times = 1):
   print(message * times)
say('Know ')
say('Program ', 3)

a) Know Program

b)
Know
Program

c)
Know
Program is printed 3 times.

d)
Know is printed 3 times.
Program is printed 3 times.

View Answer Answer:- c)
Know
Program is printed 3 times.

Also See:- Python Operators MCQ

Leave a Comment

Your email address will not be published.