A recursive function must always have:
-
A
a base case that stops the recursion
Correct answer
-
B
a global variable declared outside
-
C
a return type of void
-
D
at least two formal parameters
Correct answer
A. a base case that stops the recursion
16 views
Explanation
Without a base case the recursion never terminates and eventually exhausts the stack.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ