← Recursion & Backtracking Quiz: all 7 questions
Recursion & Backtracking Quiz · Question 1 of 7
What happens if a recursive function has no base case?
What happens if a recursive function has no base case?
- A.It returns 0
- B.It recurses forever until a stack overflow
- C.It runs once
- D.The compiler adds one automatically
Answer & explanation
Correct answer: It recurses forever until a stack overflow
Without a stopping condition, calls keep stacking up until memory for the call stack runs out.
Can you get the rest right without peeking?
Take the timed Recursion & Backtracking Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →