C++ MCQs - Recursion
This section focuses on the "Recursion" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. __________ is the technique of making a function call itself.
A. Lambdas
B. Smart
C. Recursion
D. Self
View Answer
Ans : C
Explanation: Recursion is the technique of making a function call itself
2. Recursion is important because?
A. reduce the length of our code
B. make code easy to read
C. make code easy to write
D. All of the above
View Answer
Ans : D
Explanation: Recursion is an amazing technique with the help of which we can reduce the length of our code and make it easier to read and write.
3. Recursion uses more memory.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: Recursion uses more memory, because the recursive function adds to the stack with each recursive call, and keeps the values there until the call is finished.
4. How many type of recursion there?
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: There are generally two types of recursion: Direct Recursion and Indirect Recursion
5. Which of the following are real applications of recursion in real problems?
A. Tree and graph traversal
B. Sorting algorithms
C. Divide-and-conquer algorithms
D. All of the above
View Answer
Ans : D
Explanation: All of the above are real applications of recursion in real problems.
6. Which data structure can be implemented using recursion?
A. Linked list
B. Stack
C. Queue
D. All of the above
View Answer
Ans : D
Explanation: All of the above data structure can be implemented using recursion.
7. What is mutual recursion?
A. Two functions that call each other.
B. Two functions that are unrelated to each other.
C. Two functions that are called at the same time.
D. Two functions that never terminate.
View Answer
Ans : A
Explanation: Two functions that call each other.
8. What is the difference between direct and indirect recursion?
A. Indirect recursion is faster than direct recursion
B. Direct recursion is faster than indirect recursion
C. Direct recursion calls itself directly, while indirect recursion calls another function
D. Indirect recursion calls itself directly, while direct recursion calls another function
View Answer
Ans : C
Explanation: Direct recursion calls itself directly, while indirect recursion calls another function
9. Recursion that calls itself at the end of the function known as?
A. direct recursion
B. indirect recursion
C. tail recursion
D. mutual recursion
View Answer
Ans : C
Explanation: Recursion that calls itself at the end of the function known as tail recursion.
10. Infinite recursion may lead to running out of stack memory.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Infinite recursion may lead to running out of stack memory.
Discussion