Recursion must have a __________ to stop infinite calls.
Tripura Public Service Commission - 2026,
Answer: B
Recursion must have a base case to stop infinite calls.
A recursive function calls itself on a smaller version of the problem. The base case is the condition under which it returns a result directly without calling itself, for example factorial(0) = 1. Without it, the calls would never end and the program would run out of stack space (a stack overflow).
A loop is the alternative to recursion, not part of it. A return type and a global variable do nothing to stop the chain of calls.
Please log in or register to report this question.