51. What will be the output of the following Python code?
x = ['ab', 'cd']
print(map(len, x))
x = ['ab', 'cd']
print(map(len, x))
52. How are required arguments specified in the function heading?
53. What will be the output of the following Python code?
def check(n):
if n < 2:
return n % 2 == 0
return check(n - 2)
print(check(11))
def check(n):
if n < 2:
return n % 2 == 0
return check(n - 2)
print(check(11))
54. What is tail recursion?
55. What will be the output of the following Python code?
x = ['ab', 'cd']
print(list(map(len, x)))
x = ['ab', 'cd']
print(list(map(len, x)))
56. What will be the output of the following Python code?
def f():
global a
print(a)
a = "hello"
print(a)
a = "world"
f()
print(a)
def f():
global a
print(a)
a = "hello"
print(a)
a = "world"
f()
print(a)
57. What will be the output of the following Python code?
x=12
def f1(a,b=x):
print(a,b)
x=15
f1(4)
x=12
def f1(a,b=x):
print(a,b)
x=15
f1(4)
58. What will be the output of the following Python code?
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))
elements = [0, 1, 2]
def incr(x):
return x+1
print(list(map(elements, incr)))
59. What will be the output of the following Python code?
def test(i,j):
if(i==0):
return j
else:
return test(i-1,i+j)
print(test(4,7))
def test(i,j):
if(i==0):
return j
else:
return test(i-1,i+j)
print(test(4,7))
60. What will be the output of the following Python code?
def to_upper(k):
k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))
def to_upper(k):
k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))
Read More Section(Functions in Python)
Each Section contains maximum 100 MCQs question on Functions in Python. To get more questions visit other sections.