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:

Verified
Correct Answer:
Verified
Q35: A polyline object in Java is<br>A) an
Q36: So long as one is only accessing
Q37: Just as arrays can only have a
Q38: Write a method that takes an array
Q39: Code Example Ch 08-1<br>Assume an int array,
Q40: Assume Movie is a class whose objects
Q42: Which of the following would initialize a
Q43: In a two-dimensional array, both dimensions must
Q44: If x is a char and values
Q45: Write a method to compute and return