VibraXX
Live Quiz Arena
🎁 1 Free Round Daily
⚡ Enter Arena
HomeCategoriesLogic & PuzzlesQuestion
Question
Logic & Puzzles

A recursive function calculates factorials. What happens if the base case (n=0) is omitted, causing infinite recursion?

A)Result converges to zero rapidly
B)Stack overflow error occurs eventually
C)Calculation becomes more accurate
D)Function returns default value immediately

💡 Explanation

Omitting the base case means that the function will call itself without ever stopping; recursion continues until available stack memory is exhausted, causing a stack overflow error, because the stack frame is pushed without end. Therefore, a stack overflow is the outcome, rather than returning a value, default or otherwise, or converging.

🏆 Up to £1,000 monthly prize pool

Ready for the live challenge? Join the next global round now.
*Terms apply. Skill-based competition.

⚡ Enter Arena

Related Questions

Browse Logic & Puzzles