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

15. (A) Method alter places a mirror along the major diagonal and reflects the elements from left to right across this diagonal.
In this algorithm, when row is 1, col can only be 0, and when row is 2, col takes on the values 0 and 1. Thus, only 3 elements are altered: mat[0][1], mat[0][2], and mat[1][2]. (Note that the method assigns values to mat[col][row].) These elements are all to the right of the diagonal. Choice A is the only choice that leaves elements to the left of the diagonal unc hanged.
 
































































































   1189   1190   1191   1192   1193