Unit 3 Day 3 Quiz

#1 Consider the array int[] anArray = {1,3,5,7,9,2,4};
int counter = 0;
for(int x : anArray)
  counter += x;   

What is the value of the counter?:

#2 The "for-each" loop is also referred to as the:
           

#3 The "ArrayIndexOutOfBoundsException" error is thrown when the ______ doesn't exist.:
           

#4 Consider the array from question 1. How many times does the for-each loop run?:
           

Consider the 2-D array int[][] thisArray = new int[2][3];
for(int i = 0; i < thisArray.length; i++)
  for(int j = 0; j < thisArray[i].length; j++)
   newArray[i][j] = 2 * j + 3 * i;

#5 What is the value of newArray[1][2]?:
           

  






-