← All topics
Quiz: Recursion and Stack Frames: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. What does a stack frame NOT normally contain?
- Q3. How many moves does Tower of Hanoi need for 5 discs?
- Q4. What does this print? (code)
- Q5. Why is the naive recursive Fibonacci slow?
- Q6. Which function is tail recursive?
- Q7. What usually happens when recursion has no reachable base case?
- Q8. What does this print? (code)
- Q9. In the permutation program, why is the second swap ("undo") needed?
- Q10. Each recursive call of fact(n) has its own copy of n because: