41. What will be the output of the following Python code?
x = ['ab', 'cd']
print(list(map(list, x)))
x = ['ab', 'cd']
print(list(map(list, x)))42. What will be the output of the following Python code?
def change(i = 1, j = 2):
i = i + j
j = j + 1
print(i, j)
change(j = 1, i = 2)
def change(i = 1, j = 2):
i = i + j
j = j + 1
print(i, j)
change(j = 1, i = 2)43. What will be the output of the following Python code?
def ram(x):
print(x+1)
x=-2
x=4
ram(12)
def ram(x):
print(x+1)
x=-2
x=4
ram(12)44. What will be the output of the following Python code?
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is now', x)
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is now', x)45. What will be the output of the following Python code?
x = [34, 56]
print((''.join(list(map(str, x)))),)
x = [34, 56]
print((''.join(list(map(str, x)))),)46. What is the output of the following code:
def multiply(a, b=2):
return a * b
result = multiply(4)
print(result)
def multiply(a, b=2):
return a * b
result = multiply(4)
print(result)47. What will be the output of the following Python code?
x = 5
def f1():
global x
x = 4
def f2(a,b):
global x
return a+b+x
f1()
total = f2(1,2)
print(total)
x = 5
def f1():
global x
x = 4
def f2(a,b):
global x
return a+b+x
f1()
total = f2(1,2)
print(total)48. What will be the output of the following Python code?
def f1():
x=15
print(x)
x=12
f1()
def f1():
x=15
print(x)
x=12
f1()49. What will be the output of the following Python code?
def find(a, **b):
print(type(b))
find('letters',A='1',B='2')
def find(a, **b):
print(type(b))
find('letters',A='1',B='2')50. What will be the output of the following Python code?
def foo():
return total + 1
total = 0
print(foo())
def foo():
return total + 1
total = 0
print(foo())Read More Section(Functions in Python)
Each Section contains maximum 100 MCQs question on Functions in Python. To get more questions visit other sections.
