🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. What does this print? (code)
  2. Q2. What does a stack frame NOT normally contain?
  3. Q3. How many moves does Tower of Hanoi need for 5 discs?
  4. Q4. What does this print? (code)
  5. Q5. Why is the naive recursive Fibonacci slow?
  6. Q6. Which function is tail recursive?
  7. Q7. What usually happens when recursion has no reachable base case?
  8. Q8. What does this print? (code)
  9. Q9. In the permutation program, why is the second swap ("undo") needed?
  10. Q10. Each recursive call of fact(n) has its own copy of n because: