Question 1 of 25
Hints left: 3
Q1
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)
Q2
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))
Q3
What will be the output of the following Python code? x = ['ab', 'cd'] print(map(len, x))
Q4
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)
Q5
What happens if the base condition isn't defined in recursive programs?
Q6
What will be the output of the following Python code? list(map((lambda x:x^2), range(10)))
-
A
-
B
-
C
-
D
Q7
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=" ")
Q8
Which of these is not true about recursion?
Q9
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)))
Q10
What will be the output of the following Python code? x = ['ab', 'cd'] print(len(list(map(list, x))))
Q11
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
Q12
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))
Q13
What will be the output of the following Python code? x=12 def f1(a,b=x): print(a,b) x=15 f1(4)
Q14
Which of these is false about a package?
Q15
How are required arguments specified in the function heading?
Q16
Which of the following statements is false about recursion?
Q17
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)
Q18
Lambda contains block of statements.
Q19
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)
Q20
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))
Q21
What will be the output of the following Python code? def f(): x=4 x=1 f() x
Q22
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)))
Q23
What is tail recursion?
Q24
What will be the output of the following code: def my_function(a, b): return a / b result = my_function(4, 2) print(result)
Q25
What will be the output of the following Python code? x = ['ab', 'cd'] print(list(map(len, x)))