Page 392 - AP Computer Science A, 7th edition
P. 392

/∗ ∗ @param mat the initialized matrix ∗ @param row the row number
∗/
public static void matStuff(int[][] mat, int row) {
int numCols = mat[0].length;
for (int col = 0; col < numCols; col++)
mat[row][col] = row;
}
Suppose mat is originally
1490 2786 5143
After the method call matStuff(mat,2), matrix mat will be
(A) 1 4 9 0 2786 2222
(B) 1 4 9 0 2222 5143
(C) 2 2 2 2 2222 2222
(D) 1 4 2 0 2726 5123
(E) 1 2 9 0 2286 5243
31. Assume that a square matrix mat is defined by int[][] mat = new int[SIZE][SIZE];



















































































   390   391   392   393   394