Solved

Code Example Ch 08-1

Question 41

Multiple Choice

Code Example Ch 08-1
Assume an int array, values, that is filled to capacity with the following values:
|18 | 9 | 4 | 12 | 2 | 6 | 8 |
-Refer to Code Example Ch 08-1: Which of the following loops would adequately add 1 to each element stored in values?


A) for (j=1; j<values.length; j++) values[j]++;
B) for (j=0; j<values.length; j++) values[j]++;
C) for (j=0; j<=values.length; j++) values[j]++;
D) for (j=0; j<values.length-1; j++) values[j]++;
E) for (j=1; j<values.length-1; j++) values[j]++;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions