Page 610 - AP Computer Science A, 7th edition
P. 610
(C) giveEncouragement((Beginner) w); (D) giveEncouragement(w);
(E) giveEncouragement(b);
38. A matrix class that manipulates matrices contains the following declaration:
private int[][] mat = new[numRows][numCols];
Consider the following method that alters matrix mat.
public void doSomething() {
int width = mat[0].length;
int numRows = mat.length;
for (int row = 0; row < numRows; row++)
for (int col = 0; col < width/2; col++) mat[row][col] = mat[row][width – 1 – col];
}
If mat has current value 123456 1 3 5 7 9 11
what will the value of mat be after a call to doSomething?
(A) 123321
135531
(B) 654456 11 9 7 7 9 11
(C) 654321 11 9 7 5 3 1
(D) 123456