Question: Question 13 True or false: there can only be one base case in any recursive function. Question 13 options: True False Question 14 Consider the
Question 13
True or false: there can only be one base case in any recursive function.
Question 13 options:
| True | |
| False |
Question 14
Consider the following recursive function:
public int mystery2(int n) { if(n == 0) { return mystery2(10); } else { return 2 * mystery(n - 1); } } How many times will the function mystery be called if we call mystery(5) (be sure to include the first call mystery(5))
Question 14 options:
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| The recursion will go on forever because there is no base case |
Question 15
Consider the following recursive function:
public int mystery2(int n) { if(n == 0) { return 2; } else { return 2 * mystery(n - 1); } } How many times will the function mystery be called if we call mystery(5) (be sure to include the first call mystery(5))
Question 15 options:
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| The recursion will go on forever because there is no base case. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
