41. Which of these is false about a package?
42. Lambda contains block of statements.
43. What happens if the base condition isn't defined in recursive programs?
44. What will be the output of the following Python code?
def to_upper(k):
return k.upper()
x = ['ab', 'cd']
print(list(map(upper, x)))
def to_upper(k):
return k.upper()
x = ['ab', 'cd']
print(list(map(upper, x)))
45. Observe the following Python code?
def a(n):
if n == 0:
return 0
else:
return n*a(n - 1)
def b(n, tot):
if n == 0:
return tot
else:
return b(n-2, tot-2)
def a(n):
if n == 0:
return 0
else:
return n*a(n - 1)
def b(n, tot):
if n == 0:
return tot
else:
return b(n-2, tot-2)
46. What will be the output of the following Python code?
def a(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return a(n-1)+a(n-2)
for i in range(0,4):
print(a(i),end=" ")
def a(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return a(n-1)+a(n-2)
for i in range(0,4):
print(a(i),end=" ")
47. What will be the output of the following Python code?
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
48. What will be the output of the following Python code?
def f(): x=4
x=1
f()
x
def f(): x=4
x=1
f()
x
49. What will be the output of the following Python code?
l=[1, -2, -3, 4, 5]
def f1(x):
return x<-1
m1=map(f1, l)
print(list(m1))
l=[1, -2, -3, 4, 5]
def f1(x):
return x<-1
m1=map(f1, l)
print(list(m1))
50. What will be the output of the following Python code?
a=10
b=20
def change():
global b
a=45
b=56
change()
print(a)
print(b)
a=10
b=20
def change():
global b
a=45
b=56
change()
print(a)
print(b)
Read More Section(Functions in Python)
Each Section contains maximum 100 MCQs question on Functions in Python. To get more questions visit other sections.