Select the case that applies to recursion. A selection statement, such as if-else, is called. A nested loop is called. When a base case is encountered, the recursion terminates. When a loop condition fails, the recursion terminates.
I know for sure it is not : A selection statement, such as if-else, is called.
I agree. Recursive functions can use if-else statements to check conditions, but it does not apply to all recursive cases. Consider one important part of a recursive function: the recursion cannot continue forever, or else you would never arrive at the solution to the problem. The recursion stops when a particular condition is encountered, and you may be able to recall the name of this special condition that signals the end of the recursion (it rhymes, sort of)
Ok so either C or D
Sure, which one, C or D, would apply to the condition where recursion stops? Keep in mind that recursion doesn't always need to use loops. Sometimes, similar results can be achieved with loops and recursion, but the point of recursion is that a function calls itself; the program repeats because of this repeated self-call, rather than a repeating loop. That's why I'd say D isn't quite as strong of an answer
Yeah When a base case is encountered, the recursion terminates. sounds like a little bit of an answer
Yes, base cases are very important for recursion! Without a base case, a recursive function will continue to call itself forever. If I'm not mistaken, I think it's a requirement that all recursive functions have a base case of some sort to prevent infinite recursion.
Yesss that is correct
Alright nice!
Thanks for the help once again!
You're welcome :)
Join our real-time social learning platform and learn together with your friends!