1.
Which of the following declares an array of int named beta?
A. 
B. 
C. 
D. 
2.
Int[] numList = new int[50];
for (int i = 0; i < 50; i++)
numList[i] = 2 * i;
num[10] = -20;
num[30] = 8;
How many components are in the array numList seen in the accompanying figure?
A. 
B. 
C. 
D. 
3.
What is the index number of the last component in the array numList seen in the accompanying figure?
A. 
B. 
C. 
D. 
4.
Which of the following is the array subscripting operator in Java?
A. 
B. 
C. 
D. 
5.
Suppose you have the following declaration.
double[] salesData = new double[500];
Which of the following range is valid for the index of the array salesData.
(i) 0 through 500
(ii) 0 through 499
6.
What is the output of the following Java code?
int[] list = {0, 5, 10, 15, 20};
for (int j = 0; j < 5; j++)
System.out.print(list[j] + " ");
System.out.println();
A. 
B. 
C. 
D. 
7.
What is the value of alpha[4] after the following code executes?
int[] alpha = new int[5];
for (int j = 0; j < 5; j++)
alpha[j] = 2 * j - 1;
A. 
B. 
C. 
D. 
8.
What is stored in alpha after the following code executes?
int[] alpha = new int[5];
for (int j = 0; j < 5; j++)
{
alpha[j] = 2 * j;
if (j % 2 == 1)
alpha[j - 1] = alpha[j] + j;
}
A. 
B. 
C. 
D. 
9.
Int[] list = {1, 3, 5, 7};
for (int i = 0; i < list.length; i++)
if (list[i] > 5)
System.out.println(i + " " + list[i]);
Which indices are in bounds for the array list, given the declaration in the accompanying figure?
A. 
B. 
C. 
D. 
10.
Consider the following method definition.
public static int strange(int[] list, int listSize, int item)
{
int count = 0;
for (int j = 0; j < listSize; j++)
if (list[j] == item)
count++;
return count;
}
Which of the following statements best describe the behavior of this method?
A. 
This method returns the number of values stored in list.
B. 
This method returns the sum of all the values of list.
C. 
This method returns the number of times item is stored in list.
D. 
This method can process an array of doubles.
11.
Given the following method heading
public static void mystery(int list[], int size)
and the declaration
int[] alpha = new int[75];
Which of the following is a valid call to the method mystery?
A. 
B. 
C. 
D. 
12.
How many objects are present after the code fragment in the accompanying figure is executed?
A. 
B. 
C. 
D. 
13.
Char[][] table = new char[10][5];
How many dimensions are in the array seen in the accompanying figure?
A. 
B. 
C. 
D. 
14.
Char[][] table = new char[10][5];
How many rows are in the array seen in the accompanying figure?
A. 
B. 
C. 
D. 
15.
Char[][] table = new char[10][5];
What is the value of table.length?
A. 
B. 
C. 
D. 
16.
Suppose that sales is a two-dimensional array of 10 rows and 7 columns wherein each component is of the type int. Which of the following correctly finds the sum of the elements of the fifth row of sales?
A. 
Int sum = 0;
for(int j = 0; j < 7; j++)
sum = sum + sales[5][j];
B. 
Int sum = 0;
for(int j = 0; j < 7; j++)
sum = sum + sales[4][j];
C. 
Int sum = 0;
for(int j = 0; j < 10; j++)
sum = sum + sales[5][j];
D. 
Int sum = 0;
for(int j = 0; j < 10; j++)
sum = sum + sales[4][j];
17.
Arrays have a fixed number of elements.
18.
A single array can hold components of many different data types.
19.
The statement
int[] list = new int[15];
creates list to be an array of 14 components because array index starts at 0.
20.
Given the declaration
double[] numList = new double[20];
the statement
numList[12] = numList[5] + numList[7];
updates the content of the thirteenth component of the array numList.
21.
You can create an array of reference variables to manipulate objects.