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

14. (C) Look at Example 2 for this question:
Now consider one element, 12 say. It must be replaced by its vertical mirror image 9, i.e., mat[2][3]=mat[2][0]. The value of width is 4. See which expression in the answer choices correctly makes this assignment. Eliminate choices A and D right away because col can only have the values 0 and 1 in this algorithm, so mat[2][3] will not be assigned. In choice B, when col has value 1, mat[2][3]=mat[2][1], an incorrect assignment. Choice C works: when row is 2 and col is 0, mat[2][3]=mat[2][0]. In choice E, when row is 2 and col is 0, the assignment mat[2][3]=mat[0][2] is incorrect.
 
































































































   1187   1188   1189   1190   1191