‹ Back to the paper
Recursion takes toll on memory. Which of the following option is the reason for it?
- aEvery recursive call is placed in a call stack memory.
- bEvery recursive call is resolved in Last-In-First-Out (LIFO) manner.
- cValues of local variables are maintained until each of the calls are resolved.
- dAll of the above.
Answer
Answer
AICorrect option: d
Answer: (d) All of the above.
Each recursive call is pushed onto the call stack (a), calls are resolved in LIFO order (b), and the local variables/parameters of each call must be kept until that call returns (c). All three together explain why recursion costs more memory than iteration.
From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 4.