CSC251-N811 Exam2 Study Guide Chp7
The subscript is outside the range of valid subscripts for the array.
What does it mean for a subscript to be out-of-bounds?
The arraylist class
A class in the Java API that is similar to an array and allows you to store objects.
False
If a[] and b[] are two integer arrays, the expression a == b compares the array contents.
0
The first subscript in an array is always
Arrays
Hold multiple values of the same data type simultaneously
with add method
How do you add items to an ArrayList object?
List.remove(index);
How do you remove an item from an ArrayList object?
Subscript
Identifies a specific element in the array.
Size declarator
In an array declaration, this indicates the number of elements that the array will have.
True
Java does not limit the number of dimensions an array may have
Enhanced for loop
Specialized version of the for loop that simplifies array processing
Variable length argument lists
A method that accepts any number of arguments when it is called.
True
To determine if two arrays are equal, you must compare each of the elements of the two arrays.
2D arrays
Two-dimensional arrays are sometimes called
Sorting algorithm
Used to arrange data into some order
It crashes the program and displays a runtime error message.
What happens in Java when a program tries to use a subscript that is out-of-bounds?
2 sets of brackets and 2 size declarators
What is required to declare a two-dimensional array.
0 through 3
What would the valid subscript values be in a four-element array of doubles?
True
You do not use the new key word when you provide an initialization list in One and two-Dimensional array
Length
public field that every array have
import java.util.ArrayList;
what important statement must you include in your code in order to use the ArrayList class?
The smallest value and moves it to element 0 and so on
what value in an array does the selection sort algorithm look for first? when the selection sort finds this value, what does it do with it?
True
when an array of objects is declared but not initialized the array values are set to null
True
An ArrayList object automatically expands in size to accommodate the items stored in it
True
An array's size declarator must be a non-negative integer expression.
True
Both of the following declarations are legal and equivalent:int [ ] numbers;int numbers [ ];
when the program runs
Array bounds checking happens
True
As with one and two dimensional arrays, you do not use the new key word when you provide an initialization
1 less than the number of elements
The last subscript in an array is always
Search Algorithm
A method of locating a specific item in a larger collection of data
Ragged Arrays
When the rows of a two-dimensional array are of different lengths, the array is known as