Question: 9. (12 pts) Consider the following function: int rec (int array[], int n) { int p; if (n < 0) return 0; if (array[n]
![9. (12 pts) Consider the following function: int rec (int array[], int](https://dsd5zvtm8ll6.cloudfront.net/questions/2024/04/6625d934ded3d_1713759960889.jpg)
9. (12 pts) Consider the following function: int rec (int array[], int n) { int p; if (n < 0) return 0; if (array[n] < 0) return 10; else { System.out.println (array[n]); p = array[n] + rec (array, n-2); System.out.println(p); return p; } A. What is printed? Show your box trace. int[] arr (60, 40, 20, 50, 90, 80, 30, 10}; System.out.println (rec (arr, 7)); B. What is printed? Show your box trace. int[] arr = {60, 40, -20, 50, 90, 80, 30, 10, 70}; System.out.println (rec (arr, 8));
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
