Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? def f(): x=4 x=1 f() x
Q2
What will be the output of the following Python code? def f(): global a print(a) a = "hello" print(a) a = "world" f() print(a)
Q3
Observe the following Python code? def a(n): if n == 0: return 0 else: return n*a(n - 1) def b(n, tot): if n == 0: return tot else: return b(n-2, tot-2)
Q4
What will be the output of the following Python code? l=[1, -2, -3, 4, 5] def f1(x): return x<-1 m1=map(f1, l) print(list(m1))
-
A
-
B
-
C
-
D
Q5
What will be the output of the following Python code? elements = [0, 1, 2] def incr(x): return x+1 print(list(map(elements, incr)))
Q6
What will be the output of the following Python code? x = ['ab', 'cd'] print(map(len, x))
Q7
What will be the output of the following Python code? x=12 def f1(a,b=x): print(a,b) x=15 f1(4)
Q8
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(list(map(list, x))))
Q9
What will be the output of the following Python code? a=10 b=20 def change(): global b a=45 b=56 change() print(a) print(b)
Q10
What will be the output of the following Python code? def to_upper(k): return k.upper() x = ['ab', 'cd'] print(list(map(upper, x)))
Q11
Which of these is false about a package?
Q12
What will be the output of the following code: def my_function(a, b): return a / b result = my_function(4, 2) print(result)
Q13
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(len, x)))
Q14
Which of these is not true about recursion?
Q15
What will be the output of the following Python code? def test(i,j): if(i==0): return j else: return test(i-1,i+j) print(test(4,7))
Q16
What is tail recursion?
Q17
What will be the output of the following Python code? def printMax(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a, 'is equal to', b) else: print(b, 'is maximum') printMax(3, 4)
Q18
What will be the output of the following Python code? list(map((lambda x:x^2), range(10)))
-
A
-
B
-
C
-
D
Q19
What will be the output of the following Python code? a = [1, 2, 3, 4, 5] b = lambda x: (b (x[1:]) + x[:1] if x else []) print(b (a))
Q20
What will be the output of the following Python code? def a(n): if n == 0: return 0 elif n == 1: return 1 else: return a(n-1)+a(n-2) for i in range(0,4): print(a(i),end=" ")
Q21
What happens if the base condition isn't defined in recursive programs?
Q22
What will be the output of the following Python code? def check(n): if n < 2: return n % 2 == 0 return check(n - 2) print(check(11))
Q23
Lambda contains block of statements.
Q24
Which of the following statements is false about recursion?
Q25
How are required arguments specified in the function heading?