Absolute Value of 2D Array Elements
Consider the following code segment.
int m = // some positive integer
int n = // some positive integer
int[][] table = new int[m][n];
// input values into table
for (int row = 0; row < table.length; row++)
for (int col = 0; col ‹ table[0].length; col++)
if (table[row][col] < 0)
table[row][col] = - table[row][col];
Which of the following best describes the result of executing the code segment?
A
Each element in the two-dimensional array table contains the value row - col.
B
Each element in the two-dimensional array table contains a nonnegative value.
C
Each element in the two-dimensional array table contains the opposite value from when it was initialized.
D
Each element in the two-dimensional array table contains the value 0.
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE