Live Quiz Arena
🎁 1 Free Round Daily
⚡ Enter ArenaQuestion
← Logic & PuzzlesA 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.
Related Questions
Browse Logic & Puzzles →- In a minimax search algorithm optimizing chess move selection within limited computational resources, which mechanism enables the algorithm to disregard game tree branches that are demonstrably suboptimal?
- In a distributed ledger system, which mechanism ensures a miner's proposed block is valid without revealing the block's contents to every node on the network?
- If an autonomous vehicle continuously updates its map using sensor data and a fixed-point iteration algorithm, which consequence follows when the mapping function is non-contractive?
- What distinguishes cryptographic hashes' second preimage resistance property from its preimage resistance?
- If a distributed database system experiences network partitions leading to subsets of nodes becoming isolated, which outcome regarding ACID properties is most likely to occur?
- If a database system's query optimizer relies solely on set theory's laws for simplification, which outcome occurs when evaluating a complex query with multiple joins and intersections?
