Question: Consider the following function. How would the output that is generated with the call test_a(4) be different if the System.out.println statement were listed after the
Consider the following function. How would the output that is generated with the call test_a(4) be different if the System.out.println statement were listed after the recursive call in this function? void test_a(int n) { System.out.println(n + " "); if (n>0) test_a(n-2); }
a) The integers would print in ascending order instead of in descending order.
| b) | The integers would print in descending order instead of in ascending order. |
| c) | There would be no difference in the output of this function. |
| d) | The recursive call would never execute because the base case would be true immediately. a, b, c or d? |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
