| preferred AP College board partner for AP classes
AP Computer Science A/Unit 8: 2D Array
Start Practice Test
Share
easy Solved by 2 students
2D Array Column Maximum
< Prev
Next >

Given a method designed to find the maximum value in any column of a 2D integer array data, choose the correct code to complete the method implementation.

public int findMaxInColumn(int[][] data, int col) {
  int max = Integer.MIN_VALUE;
  for (int row = 0; row < data.length; row++) {
    // missing code
  }
  return max;
}

Which of the following options will accurately complete the method to find the maximum value in the specified column?

A

max = Math.max(max, data[data.length - 1][col]);

B

max = Math.max(max, data[0][col]);

C

max = Math.max(max, data[col][row]);

D

max = Math.max(max, data[row][col]);

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Not enough data yet to show leaderboard.

APFIVE © 2020.
Email: [email protected]|Privacy Policy