ExamVeda
Login
Home
31
What will be the output of the following Python code?
def foo(i, x=[]):
    x.append(i)
    return x
for i in range(3):
    print(foo(i))
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
32
What does the nonlocal keyword do when used in a function?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
33
What will be the output of the following Python code?
def f(x):
    print("outer")
    def f1(a):
        print("inner")
        print(a,x)
f(3)
f1(1)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
34
What will be the output of the following Python code?
def f1(a,b=[]):
    b.append(a)
    return b
print(f1(2,[3,4]))
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
35
What will be the output of the following Python code?
x = abcd
print(list(map(list, x)))
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
36
How can you define a function that accepts an arbitrary number of keyword arguments?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
37
Which of these is not true about recursion?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
38
Which of the following is the use of function in python?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
39
What will be the output of the following Python code?
def f1():
    x=100
    print(x)
x=+1
f1()
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
40
What is the output of the following code:
def power(x, n=2):
  return x ** n
result = power(3)
print(result)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board