Chapter 8 Flashcards
An array is a list of data items that all
have the same type.
When you declare an array
You might reserve memory for it in the same statement.
For how many integers does the following statement reserve room? int[] values = new int[34];
34 integers
Which of the following can be used as an array subscript? Char, String, double, int.
Int
If you declare an array as follows, how do you indicate the final element of the array?
Int[] nuns = new int[6];
Nums[5]
Int[] nums = {101, 202, 303, 404, 505, 606};
What is the value of nums[2]?
303
When you initialize an array by giving it values upon creation, you
Do not explicitly give the array a size
In Java, you can declare an array of 12 elements and initialize
All of them
You can assign the value 100 to each element in the array declared by
Int[] nums = new int[4];
For(x<0; x<4; ++x) nums[x]=100;
What is the value of creditScores.length in the following array?
Int[] creditScores = {670, 720, 815};
3
A parallel array is one that
Holds values that correspond to those in another array
When you pass an array element to a method, the method receives
A copy of the value in the element
A single array element of a primitive type is passed to a method by
Value
When you pass an array to a method, the method receives
The address of the array
When you place objects in order beginning with the object with the highest value, you are sorting in _____ order.
Descending