Chapter 7: Arrays and the ArrayList Class
True or False: An array's size declarator can be a negative integer expression
False
True or False: The first size declarator in the declaration of a two-dimensional array represents the number of columns. The second size declarator represents the number of rows
False
This is the maximum number of comparisons performed by the sequential search on an array of N elements (assuming the search values are consistently found)
N/2
True or False: A two-dimensional array has multiple length fields
True
True or False: An ArrayList automatically expands in size to accommodate the items stored in it
True
True or False: Both of the following declarations are legal and equivalent: int[] numbers; int numbers[];
True
True or False: Java does not allow a statement to use a subscript that is outside the range of valid subscripts for an array
True
True or False: The Java compiler does not display an error message when it processes a statement that uses an invalid subscript
True
True or False: The subscript of the last element in a single-dimensional array is one less than the total number of elements in the array
True
True or False: The values in an initialization list are stored in the array in the order they appear in the list
True
True or False: When an array is passed to a method, the method has access to the original array
True
To insert an item at a specific location in an ArrayList object, use this method
add
To store an item in an ArrayList object, use this method
add
This search algorithm repeatedly divides the portion of an array being searched in half
binary search
When initializing a two-dimensional array, you enclose each row's initialization list in these.
braces
This array field holds the number of elements that the array has.
length
The first subscript in an array is always
0
The last subscript in an array is always
1 less than the number of elements
To delete an item from an ArrayList object, use this method
remove
This search algorithm steps through an array, comparing each item with the search value
sequential search
To determine the number of items stored in an ArrayList object, use this method.
size
In an array declaration, this indicates the number of elements that the array will have.
size declarator
Each element of an array is accessed by a number known as a(n)
subscript
Array bounds checking happens
when the program runs