Here is an interesting Python Multiple choice questions Quiz. Attempting this MCQ will help you to evaluate your knowledge and skills.
Q1 What is the output of following code?
def fun(name,age):
print(name)
print(age)
fun(25,”tom”)
a)25 tom
b)25 ‘tom’
c) tom 25
d)tom ‘25’
Q2. What is the output of following code?
def fun(name,age):
print(“name is “,name)
print(“age is “,age)
fun(age=25,name=”jack”)
a) name is jack age is 25
b) name is 25 age is ‘jack’
c)Error
d)None of the above
Q3. What is the output of following code?
def fun(name,age):
print(“name is “,name)
print(“age is “,age)
fun(25,”Harry”)
a) name is 25 age is Harry
b) Error
c)name is Harry age is 25
d) None of the above
Q4.What is the output of following code?
def f1(list1):
list1[0]=100
list2=[1,2,3]
f1(list2)
print(“list1 is “,list1)
a)list1 is [100,2,3]
b)Error
c)list1 is [1,2,3]
d)None of the above
Q5.What is the output of following code?
def f2(list1):
list1[0]=500
print(“list1 is “,list1)
list2=[1,2,3]
f2(list2)
print(“list2 is “,list2)
a) list1 is [500, 2, 3] list2 is [500, 2, 3]
b)Error
c) list1 is [500, 2, 3] list2 is [1, 2, 3]
d)None of the above
Q6. What is the output of following code?
def f3(list1):
list1[0]=500
print(“list1 is “,list1)
list2=[1,2,3]
f3(list2[:])
print(“list2 is “,list2)
a) list1 is [500, 2, 3] list2 is [1, 2, 3]
b)Error
c) list1 is [500, 2, 3] list2 is [500, 2, 3]
d)None of the above
Q7. In following code, k is .
def function2(k): print(type(k)) function2() a)tuple b)dictionary c)string d)list Answer a Q9. In following code, x is .
def function2(*x):
print(type(x))
function2()
a)tuple
b)dictionary
c)string
d)list
Q8. What is the output of the following code?
y = 8
z = lambda x : x * y
print (z(6,6) )
a)36
b)48
c)Error
d)None of the above