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