Answer to Question #214169 in C++ for Jaguar

Question #214169

QUESTION 1 

 

Consider the following declarations: 

const int NUMELS 10; 

int values[NUMELS]; 

Which of the following array accesses is valid? 

1. values[-1] 

2. values[10] 

3. values[0] 

4. values[11] 


QUESTION 2 

 

Consider the following code segment that finds the maximum value store in an array named grade of size NUMELS. 

What is the missing line of code indicated by the blank line? 

___________ 

for (i = 1; i < NUMELS; i++) 

 if (grade[i] > maximum) 

 maximum = grade[i]; 

1. maximum = grade[1]; 

2. maximum = grade[0];

3. maximum = 100; 

4. maximum = grade[NUMELS];


1
Expert's answer
2021-07-06T02:08:31-0400

Question 1

The correct answer is option 3.  values[0] will access the first value in that array

Question 2.

The correct answer is option 2.  maximum = grade[0]; will initialize the maximum as the first element in the array.


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