CBSE Class 12 Computer Science Question 32 of 101

Functions — Question 12

Back to all questions
12
Question

Question 12

What happens if the base condition isn't defined in recursive programs?

  1. Program gets into an infinite loop
  2. Program runs once
  3. Program runs n number of times, where n is the argument given to the function
  4. An exception is thrown
Answer

Program gets into an infinite loop

Reason — When the base condition in a recursive program is not properly defined, the recursive calls continue indefinitely without a stopping criterion. This leads to an infinite loop where the program keeps executing recursive calls without making progress towards a termination point.