Recursion MCQs

6 MCQs  — Fundamental Programming MCQs

Practice Recursion MCQs with correct answers and explanations. These questions are from the Fundamental Programming MCQs section.

What happens when a recursive Python function has no reachable base case?
RecursionError (maximum recursion depth exceeded)
SyntaxError
It returns None
It loops forever without any error
Does CPython optimize tail-recursive calls (tail-call optimization)?
Only in Python 3.11 and later
No; tail calls still consume stack frames
Yes, always
Yes, when @tailrec is used
Which statement about recursion compared with iteration is correct?
Some problems can only be solved recursively
Recursion is always faster than iteration
Any recursive algorithm can be rewritten iteratively, typically by using an explicit stack
Recursion uses less memory than iteration