KnowledgeBoat Logo

Computer Science

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

Python Functions

1 Like

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.

Answered By

3 Likes


Related Questions