Question 1 of 25
Hints left: 3
Q1
What is a variable defined inside a function referred to as?
Q2
What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x)))))
Q3
What is the purpose of the assert statement in Python?
Q4
What will be the output of the following Python code? x=100 def f1(): global x x=90 def f2(): global x x=80 print(x)
Q5
How many keyword arguments can be passed to a function in a single function call?
Q6
How can you define a function that accepts both positional and keyword arguments?
Q7
. . . . . . . . returns a dictionary of the module namespace. . . . . . . . . returns a dictionary of the current namespace.
Q8
What will be the output of the following Python code? x = 50 def func(): global x print('x is', x) x = 2 print('Changed global x to', x) func() print('Value of x is', x)
Q9
What is the output of the following code: square = lambda x: x**2 result = square(5) print(result)
Q10
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)))
Q11
What will be the output of the following Python code? x = [12.1, 34.0] print(len(' '.join(list(map(str, x)))))
Q12
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)
-
A
-
B
-
C
-
D
Q13
What will be the output of the following Python code? x = [12, 34] print(len(list(map(int, x))))
Q14
What is the base case in the Merge Sort algorithm when it is solved recursively?
Q15
What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x))),))
Q16
Which keyword is used for function?
Q17
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(map(list, x)))
Q18
If a function doesn't have a return statement, which of the following does the function return?
Q19
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(upper, x)))
Q20
What will be the output of the following Python code? def foo(k): k = [1] q = [0] foo(q) print(q)
Q21
What will be the output of the following Python code? def f(x, y, z): return x + y + z f(2, 30, 400)
Q22
Only problems that are recursively defined can be solved using recursion.
Q23
What will be the output of the following Python code? lamb = lambda x: x ** 3 print(lamb(5))
Q24
The output of the following codes are the same. [x**2 for x in range(10)] list(map((lambda x:x**2), range(10)))
Q25
What will be the output of the following Python code? x = 'abcd' print(list(map([], x)))