LearnFrenzy
Sign in Take a free test

Functions and Default Arguments · Functions MCQ · Question 10

What happens if a recursive function has no base case? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

What happens when a recursive function never reaches a base case?

  • A It returns 0
  • B It keeps calling itself until the call stack overflows and the program crashes Correct
  • C The compiler adds a base case
  • D It loops quietly forever without using memory
Correct Answer: Option B

Every call uses a new stack frame, so unbounded recursion exhausts the stack (stack overflow).

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