Exam-style question
Try this first
A subroutine calls itself recursively. Why can separate stack frames be needed for the different calls?.
- A.Each call has its own return address, parameters and local variables
- B.Only the first call needs a stack frame; later calls share all its data
- C.Recursive calls do not use stack frames
- D.A new frame is created only when a parameter has no value
Answer and explanation
Concise answer
Each call has its own return address, parameters and local variables
Why this is correct
Each recursive call is a separate active subroutine call. Its stack frame preserves its own data and return location, so the calls can later return in the correct order.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
