MCQ Single Best Answer Moderate

Q[Recursion]
Recursion takes toll on memory. Which of the following option is the reason for it?

ID: #24937 Competency focused Practice Questions ISC Class XII Computer Science 5 views
Question Info
#24937Q ID
ModerateDifficulty
Competency focused Practice Questions ISC Class XII Computer ScienceTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Every recursive call is placed in a call stack memory.
  • B Every recursive call is resolved in Last-In-First-Out (LIFO) manner.
  • C Values of local variables are maintained until each of the calls are resolved.
  • D All of the above.
Correct Answer: Option D

Explanation

[Recursion]
Recursion takes toll on memory. Which of the following option is the reason for it?
(a) Every recursive call is placed in a call stack memory.
(b) Every recursive call is resolved in Last-In-First-Out (LIFO) manner.
(c) Values of local variables are maintained until each of the calls are resolved.
(d) All of the above.
Correct Answer: (d) All of the above

Explanation:

Recursion uses a call stack to keep track of function calls. Each time a recursive function is called, a new stack frame is created.

  • (a) Call Stack Usage: Each recursive call is stored in stack memory. More recursive calls = more memory usage.
  • (b) LIFO Mechanism: The stack works on Last-In-First-Out (LIFO). The last function call finishes first, but all calls remain in memory until resolved.
  • (c) Local Variables Storage: Every recursive call keeps its own copy of local variables, and these stay in memory until that specific call completes.

Because of all these reasons combined, recursion consumes more memory — especially for deep recursive calls.

Conclusion: All given options correctly explain why recursion takes more memory.

Share This Question

Challenge a friend or share with your study group.