Python Quiz

1) Which of these is false about recursion?
1 point
Clear selection
2) Fill in the line of the following Python code for calculating the factorial of a number def fact(num): if num == 0: return 1 else: return _____________________
1 point
Clear selection
3)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))
2 points
Clear selection
4) What is the average case complexity of selection sort?
1 point
Clear selection
5) What is the average case complexity of MERGE sort?
1 point
Clear selection
6) What is the average case complexity of Linear Search?
1 point
Clear selection
7)What is tail recursion?
1 point
Clear selection
8) What is the average case complexity of Binary Search?
1 point
Clear selection
9) what is the output of following code? def fun(n): if (n > 100): return n - 5 return fun(fun(n+11)); print(fun(55))
2 points
Clear selection
10)The time complexity of the solution tower of hanoi problem using recursion is _________
1 point
Clear selection
11) def f1(): x=100 print(x)x=+1 f1() what will be the output?
2 points
Clear selection
What will be the output of the following Python code?1 def a(n) : if n == 0: . return o . elif n == 1: . return 1 . else: . return a(n-1)+a(n-2) . for i in range(0,4): . print(a(i),end=" ")
2 points
Clear selection
13) Where is linear searching used?
1 point
Clear selection
14) Which of the following is a disadvantage of linear search?
1 point
Clear selection
15) def outerFun(a, b): def innerFun(c, d): return c + d return innerFun(a, b) res = outerFun(5, 10) print(res)
2 points

Post a Comment

0 Comments