← Quiz: Recursion and Stack Frames: all 10 questions
Quiz: Recursion and Stack Frames · Question 10 of 10
Each recursive call of fact(n) has its own copy of n because:
Each recursive call of fact(n) has its own copy of n because:
- A.n is a global variable
- B.n is static
- C.each call gets its own stack frame holding its parameters
- D.the compiler copies n into the heap
Answer & explanation
Correct answer: each call gets its own stack frame holding its parameters
Separate frames mean separate copies, so the calls do not overwrite each other's n.
Can you get the rest right without peeking?
Take the timed Quiz: Recursion and Stack Frames quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →