# 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)

1.  Both a() and b() aren’t tail recursive

2.  Both a() and b() are tail recursive

3.  b() is tail recursive but a() isn’t

4.  a() is tail recursive but b() isn’t

4

b() is tail recursive but a() isn’t

Explanation :
No Explanation available for this question

# Which of the following statements is false about recursion

1.  Every recursive function must have a base case

2.  Infinite recursion can occur if the base case isn’t properly mentioned

3.  A recursive function makes the code easier to understand

4.  Every recursive function must have a return value

4

Every recursive function must have a return value

Explanation :
No Explanation available for this question

# What will be the output of the following Python code def fun(n): if (n > 100): return n - 5 return fun(fun(n+11)); print(fun(45))

1.  50

2.  100

3.  74

4.  Infinite loop

4

100

Explanation :
No Explanation available for this question

# Recursion and iteration are the same programming approach.

1.  True

2.  False

2

False

Explanation :
No Explanation available for this question

# What happens if the base condition isn’t defined in recursive programs

1.  Program gets into an infinite loop

2.  Program runs once

3.  Program runs n number of times where n is the argument given to the function

4.  An exception is thrown

4

Program gets into an infinite loop

Explanation :
No Explanation available for this question

# Which of these is not true about recursion

1.  Making the code look clean

2.  A complex task can be broken into sub-problems

3.  Recursive calls take up less memory

4.  Sequence generation is easier than a nested iteration

4

Recursive calls take up less memory

Explanation :
No Explanation available for this question

# Which of these is not true about recursion

1.  It’s easier to code some real-world problems using recursion than non-recursive equivalent

2.  Recursive functions are easy to debug

3.  Recursive calls take up a lot of memory

4.  Programs using recursion take longer time than their non-recursive equivalent

4

Recursive functions are easy to debug

Explanation :
No Explanation available for this question

# 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=" ")

1.  0 1 2 3

2.  An exception is thrown

3.  0 1 1 2 3

4.  0 1 1 2

4

0 1 1 2

Explanation :
No Explanation available for this question

# Which type of copy is shown in the following python code l1=[[10, 20], [30, 40], [50, 60]] ls=list(l1) ls [[10, 20], [30, 40], [50, 60]]

1.  Shallow copy

2.  Deep copy

3.  memberwise

4.  All of the mentioned

4

Shallow copy

Explanation :
No Explanation available for this question

# What will be the output of the following Python code l=[2, 3, [4, 5]] l2=l.copy() l2=88 l l2

1.  [88, 2, 3, [4, 5]][88, 2, 3, [4, 5]]

2.  [2, 3, [4, 5]][88, 3, [4, 5]]

3.  [88, 2, 3, [4, 5]][2, 3, [4, 5]]

4.  [2, 3, [4, 5]][2, 3, [4, 5]]

4