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

 

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!