MCQ on Recursion – Recursion Objective Questions for Practice

MCQ on Recursion

Recursion is the most important concept in computer science. In this tutorial, You’ll find lot of practice questions related to recursion which will help you to grasp the concept.

In my previous posts, i have written about binary search implementation using recursion and difference between recursion and iteration.

These MCQ helps you to understand the concept of Recursion. These are some of the tricky questions on recursion which i collected for practice.

1) Which Data Structure is mainly used for implementing the recursive algorithm?

a) Queue
b) Stack
c) Linked List
D) Tree

2) What’s the output of the following code ?

a)4
b)2
c)3
d)6

3) What’s happen if base condition is not defined in recursion ?

a) Stack underflow
b) Stack Overflow
c) None of these
d) Both a and b

4) Select the correct output.

a) 4
b) 12
c) 22
d) 21

5) Choose correct option.

a) 12
b) 24
c) 1
d) 0

6)

what will be the output of func(3,8) .

a) 11
b) 24
c) 22
d) 21

7)

What will be the output of print(12).

a) 0011
b) 1100
c) 1001
d) 1000

8)

What will be the output of sum(8).

a) 40
b) 36
c) 8
d) 15

9) Choose the correct answer.

a) Recursion is always better than iteration.
b) Recursion uses more memory compared to iteration.
c) Recursion uses less memory compared to iteration.
d) Iterative function is always better and simpler to write than recursion.

10) Recursion is similar to which of the following?

a) Switch Case
b) Loop
c) If-else
d) None

11) Recursion uses more memory compared to iteration.

a) True
b) False
c) Both
d) None of the above

12) Which of the following problem cannot be solved using recursion?

a) Tower of Hanoi
b) Fibonacci series
c) Tree Traversal
d) Problems without base case

13) Which searching can be performed recursively?

a) Linear search
b) Binary search
c) Both
d) None

14) In recursion the condition after which the function will stop calling itself is

a) Base condition
b) Function call
c) Both
d) None

Programming Questions on Recursion – Video Tutorials

Sort a stack using recursion

Reverse a stack using recursion

Answers

1) (b) Stack data structure is mainly used for implementing the recursive algorithm. Recursion uses system stack for storing the return addresses of the function calls.

So, Stack data structure is used to implement recursive function calls.

2) (d)

Explanation

3) (b)

When base condition is not defined in recursion, function will call itself infinitely which leads to a stack overflow exception (It is a situation in which the allocated space of a program is completely exhausted due to function calls).

4) (c)

5) (b)

It’s the recursive implementation of a factorial. Explanation of factorial using recursion.

6) (b)

7) (a)

8) (b)
For explanation check find sum of n natural numbers using recursion

9) (b)

Recursion uses more memory compared to iteration.

10) (b)

In recursion, the function will call itself until the base condition is not true. So, Recursion is similar to a loop and it will call itself until the base condition is not true.

11) (a)

Iteration requires less memory than recursion. In recursion, Each function call is stored in a call stack. So, This statement recursion uses more memory compared to iteration is true.

12) (d)

13)  (c) We can implement both linear and binary search recursively as well as iteratively.

14) (a) In recursion, when the base condition is true then the function will stop calling itself. It is the terminating condition.

Tagged , , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.