Question: 1 6 . Consider the following method. / * * Precondition: values has at least one row * / public static int calculate ( int

16. Consider the following method.
/** Precondition: values has at least one row */
public static int calculate(int[][] values)
9
{ int found = values[0][0];
int result =0;
for (int[] row : values)
{ for (int y =0; y < row.length; y++)
{ if (row[y]> found)
{ found = row[y];
result = y;
}
}
}
return result;
}
Which of the following best describes what is returned by the calculate method?
(A) The largest value in the two-dimensional array
(B) The smallest value in the two-dimensional array
(C) The row index of an element with the largest value in the two-dimensional array
(D) The row index of an element with the smallest value in the two-dimensional array
(E) The column index of an element with the largest value in the two-dimensional array

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 Databases Questions!

Q:

0