1.
Why is a base case needed in a recursive function?
- If a recursive function didn’t have a base case, then the function would end too early.
- Incorrect. The complete opposite would happen instead.
- If a recursive function didn’t have a base case, then the function would return an undesired outcome.
- Incorrect. In fact, the program wouldn’t return anything.
- If a recursive function didn’t have a base case, then the function would continue to make recursive calls creating an infinite loop.
- Correct! a base case is needed to end the continuous recursive calls, so that the program doesn’t get stuck in a never ending loop.
- If a recursive function didn’t have a base case, then the function would not be able to ever make recursive calls in the first place.
- Incorrect. Recursive calls will continue to be called even without a base case.
