81. What is a variable defined inside a function referred to as?
82. What will be the output of the following Python code?
x = [[0], [1]]
print((' '.join(list(map(str, x))),))
x = [[0], [1]]
print((' '.join(list(map(str, x))),))
83. What will be the output of the following Python code?
def foo(i, x=[]):
x.append(x.append(i))
return x
for i in range(3):
y = foo(i)
print(y)
def foo(i, x=[]):
x.append(x.append(i))
return x
for i in range(3):
y = foo(i)
print(y)
84. What will be the output of the following Python code?
def foo(k):
k = [1]
q = [0]
foo(q)
print(q)
def foo(k):
k = [1]
q = [0]
foo(q)
print(q)
85. What will be the output of the following Python code?
x = [12, 34]
print(len(''.join(list(map(int, x)))))
x = [12, 34]
print(len(''.join(list(map(int, x)))))
86. On assigning a value to a variable inside a function, it automatically becomes a global variable.
87. Which of the following data structures is returned by the functions globals() and locals()?
88. What will be the output of the following Python code?
def power(x, y=2):
r = 1
for i in range(y):
r = r * x
return r
print power(3)
print power(3, 3)
def power(x, y=2):
r = 1
for i in range(y):
r = r * x
return r
print power(3)
print power(3, 3)
89. Does Lambda contains return statements?
90. What will be the output of the following Python code?
l=[-2, 4]
m=map(lambda x:x*2, l)
print(m)
l=[-2, 4]
m=map(lambda x:x*2, l)
print(m)
Read More Section(Functions in Python)
Each Section contains maximum 100 MCQs question on Functions in Python. To get more questions visit other sections.