Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 3 students

2D Array Column Maximum

< Prev
Next >

The following method is intended to return the maximum value in a specified column of a 2D integer array.

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 code segment should replace // missing code for the method to work as intended?

A

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

B

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

C

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

D

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

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ