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
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option D
Explanation
[Recursion]
Recursion takes toll on memory. Which of the following option is the reason for it?
Recursion takes toll on memory. Which of the following option is the reason for it?
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.