9. Consider the following function: int rec (int array[], int n) { int p; if (n


A and B


9. Consider the following function:<br>int rec (int array[], int n) {<br>int p;<br>if (n < 0)<br>return 0;<br>if (array[n] <<br>0)<br>else {<br>return 10;<br>System.out.println(array[n]);<br>array[n] + rec (array,n-2);<br>System.out.Rrintln(p);<br>return<br>p;<br>}<br>}<br>A. What is printed? Show your box trace.<br>int[] arr =<br>{60, 40, 20, 50, 90, 80, 30, 10};<br>System.outprintln(rec (arr,7));<br>B. What is printed? Show your box trace.<br>int[] arr =<br>System.outRrintln(rec (arr,8));<br>{60, 40, -20, 50, 90, 80, 30, 10, 70};<br>

Extracted text: 9. Consider the following function: int rec (int array[], int n) { int p; if (n < 0)="" return="" 0;="" if="" (array[n]="">< 0)="" else="" {="" return="" 10;="" system.out.println(array[n]);="" array[n]="" +="" rec="" (array,n-2);="" system.out.rrintln(p);="" return="" p;="" }="" }="" a.="" what="" is="" printed?="" show="" your="" box="" trace.="" int[]="" arr="{60," 40,="" 20,="" 50,="" 90,="" 80,="" 30,="" 10};="" system.outprintln(rec="" (arr,7));="" b.="" what="" is="" printed?="" show="" your="" box="" trace.="" int[]="" arr="System.outRrintln(rec" (arr,8));="" {60,="" 40,="" -20,="" 50,="" 90,="" 80,="" 30,="" 10,="">

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here