Hard Multiple Choice QuestionsΒΆ

These problems are harder than those that you will typically see on the AP CS A exam.

9-9-1: What are the contents of arr after the following code has been executed?

int[][] arr = {{3,2,1},{1,2,3}};
int value = 0;
for (int row = 1; row < arr.length; row++) {
   for (int col = 1; col < arr.length; col++) {
      value = arr[row][col];
      if (value % 2 == 1) arr[row][col] = value + 1;
      if (arr[row][col] % 2 == 0) arr[row][col] = value * 2;
   }
}