Python - MCQ
Multiple Choice Questions
Python - Multiple Choice Questions (MCQ) - Python functions, Modules and Packages - Set 26
31. Python function always returns a value
A). TRUE
B). FALSE
View Answer
Correct: A
32. Select which is true for Python function
A). A Python function can return only a single value
B). A function can take an unlimited number of arguments.
C). A Python function can return multiple values
D). Python function doesn’t return anything unless and until you add a return statement
View Answer
Correct: B, C
33. What is the output of the following function call
def fun1(name, age=20):
print(name, age)
fun1('Emma', 25)
A). Emma 25
B). Emma 20
View Answer
Correct: A
34. Choose the correct function declaration of fun1() so that we can execute the following function call successfully
fun1(25, 75, 55)
fun1(10, 20)
A). def fun1(**kwargs)
B). No, it is not possible in Python
C). def fun1(args*)
D). def fun1(*data)
View Answer
Correct: D
35. What is the output of the following display() function call
def display(**kwargs):
for i in kwargs:
print(i)
display(emp="Kelly", salary=9000)
A). TypeError
B). Kelly
9000
C). (’emp’, ‘Kelly’)
(‘salary’, 9000)
D). emp
salary
View Answer
Correct: D