LearnFrenzy
Sign in Take a free test

Recursion · Recursion MCQ · Question 8

Local variables in recursive calls Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

Do recursive calls share their local variables?

  • A Yes – all calls use the same variables
  • B Only parameters are shared
  • C No – each call has its own frame with its own locals Correct
  • D Only in nested functions
Correct Answer: Option C

That is why n in each call keeps its own value while deeper calls run.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links