Answer to Question #214182 in C++ for Jaguar

Question #214182

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] << " ";


1
Expert's answer
2021-07-11T14:35:12-0400

QUESTION 20

3.5

QUESTION 23

1. for (j = 0; j <= 49; j++) 

cout << gamma[j] << " ";


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS