Considering the following algorithm, which statement is true? Assume the variabl
ID: 3779549 • Letter: C
Question
Considering the following algorithm, which statement is true? Assume the variable i is greater than or equal to zero. Select all that apply. public static void doSomething(int i) {doSomething(i - 1);} None of the other options. It doesn't have a base case, or it has one that doesn't execute. It doesn't actually do recursion. It can result in infinite recursion. Considering the following algorithm, which statement is true? Assume the variable i is greater than or equal to zero. Select all that apply. public static void doSomething(int i) {doSomething(i - 1); if(i ==0) return;} It doesn't actually do recursion. None of the other options. It doesn't have a base case, or it has one that doesn't execute. It can result in infinite recursion.Explanation / Answer
Answer to Question 4
-It doesn't have a base case, or it has that doesnt execute
-It can result in infinte recursion
Answer to Question 5
-none of the other option
It is a perfect example of recursion. It has a base condtion of returning when i==0. and it simplyfies the problem to smaller one in each iteration
//Note: Feel free to ask any doubts/queries. God bless you!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.