IT 114: Introduction to Java
Answers to Class 15 Ungraded Quiz
-
If you had an array numbers,
what would you write to get the first value?
numbers[0]
-
If the array numbers contained
5 values, what would you write to get the last value?
numbers[4]
-
What do you call the values in an array?
elements
-
Can an array contain values of different data types?
no
-
Can you change the size of an array after you
have declared it?
no
-
What would you write if you wanted to change
the 2nd value in the array numbers
to 6?
numbers[1] = 6
-
What do you call the number that specifies a particular
value inside an array?
an index
-
What expression would you write to get the length
of the array numbers?
numbers.length
-
Rewrite the statement below using and augmented
assignment operator.
x = x + 1
x += 1
-
Rewrite the statement below using and augmented
assignment operator.
y = y - 1
y -= 1