# Recursion in Python MCQ for Class 12 CBSE

Recursion in Python MCQ for CBSE Class 12 Computer Science students. Important Objective Questions from NCERT and Sumita Arora Python Book for examination point of view

### What is Recursion in Python?

Recursion refers to a programming technique in which a function calls itself either directly or indirectly.

### Objective MCQ on Recursion

1. Could a method(function) invoke or call itself.
a) yes
b) no

yes

2. What is direct recursion.
a) A function calls itself from the body
b) A function is called from another function.
c) Redo and undo is done.
d) Compiler is used instead of interpreter.

a) A function calls itself from the body

3. What is indirect recursion.
a) A function calls itself from the body
b) A function is called from another function.
c) Redo and undo is done.
d) Compiler is used instead of interpreter.

b) A function is called from another function.

4. Choose the correct output.

def compute(num):
if (num==1):
return 1
else:
return (num + compute(num-1))
last=4
ssum= compute(last)
print(ssum)

a)12
b)14
c)10
d)6

c)10

5. Choose the correct output

def bp(sg,n):
if n>0:
print(sg[n],end=’ ‘)
bp(sg,n-1)
elif n==0:
print(sg[0])

s=input(“Enter a string”)
bp(s,len(s)-1)

input is – NEWS
1)news
2)News
3)SWEN
4)swen

3)SWEN

6.If there is no base case, or if the base case is never executed, an infinite recursion occurs.
1)True
2)False

1)True

7.
def macro(n):
if n<2:
return 1
return n *macro(n)

n=int(Input(“Enter a number(>0):”))
print(macro(n))

input n= 4
a)20
b)25
c)24
d)26

c)24

8.Fibonacci series
Each succeeding number is the sum of the two preceding Fibonacci numbers.
1)true
2)false

1)true

9.
def fib(n):
if n==1:
return 0
elif n==2:
return 1
else:
return fib(n-1)+fib(n-2)
n=int(input(“enter last term required”))
for i in range(1,n+1):
print(fib(i), end=’,’)
Enter last term required: 5
Output will be
a)0, 1, 2, 3, 4,
b)0,1,1,2,3
c)01123
d)0,1,1,6

b)0,1,1,2,3

10.Are Recursive functions are relatively slower than their iterative counterparts.
a)True
b)False

a)true

11. Iteration uses same memory space for each pass contrary to recursion where fresh memory is allocated for each successive call.
a)True
b)False

a)true

12.There are two cases in each recursive functions; the recursive case and the base case.
a) True
b) false

a)true

13.The base case is the case whose solution is pre-known and is used without computation.
a) True
b) false

a)true

14.The recursive case is more general case of problem, which i being solved.
a) True
b) false