QUESTION 20
What is the value of alpha[2] after the following code executes?
int alpha[5];
int j;
for (j = 0; j < 5; j++)
alpha[j] = 2 * j + 1;
1. 1
2. 4
3. 5
4. 6
QUESTION 23
Suppose that gamma is an array of 50 elements of type int and j is an int variable. Which of the following for loops
sets the subscript of gamma out-of-range?
1. for (j = 0; j <= 49; j++)
cout << gamma[j] << " ";
2. for (j = 1; j < 50; j++)
cout << gamma[j] << " ";
3. for (j = 0; j <= 50; j++)
cout << gamma[j] << " ";
4. for (j = 0; j <= 48; j++)
cout << gamma[j] << " ";
QUESTION 20
3.5
QUESTION 23
1. for (j = 0; j <= 49; j++)
cout << gamma[j] << " ";
Comments
Leave a comment