Deck 10: Introduction to Arrays
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/47
Play
Full screen (f)
Deck 10: Introduction to Arrays
1
The items in an array are called ____.
A) elements
B) values
C) variables
D) objects
A) elements
B) values
C) variables
D) objects
A
2
When an array is not full, one must replace the array's logical size with its physical length in the loop.
False
3
When referring to an array element, the subscript operator is ____.
A) .
B) { }
C) [ ]
D) < >
A) .
B) { }
C) [ ]
D) < >
C
4
When referring to an array element, the method selector is ____.
A) .
B) { }
C) [ ]
D) < >
A) .
B) { }
C) [ ]
D) < >
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
5
Once an array is instantiated, its size cannot be changed. ____________________
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
6
When setting up an array, you need to instantiate an array object and assign it to the array declaration. ____________________
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
7
An item's position within an array is called its ____.
A) index
B) subscript
C) path
D) both a and b are true.
A) index
B) subscript
C) path
D) both a and b are true.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
8
In an array, the first element is numbered 1.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
9
Array variables are blank before they are assigned array objects. ____________________
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
10
The JVM checks the values of subscripts before using them and throws an exception if they are out of bounds.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
11
Each array variable must be declared in its own statement.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
12
For any particular array, all of the elements must be of the same type.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
13
An array with elements numbered 0 to 99 has a length of 99. ____________________
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
14
It is important to remember the length of an array when working with it.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
15
The basic syntax for referring to an array ____ has the form [].
A) length
B) element
C) name
D) initializer
A) length
B) element
C) name
D) initializer
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
16
In order to set up an array, you need to declare an array variable.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
17
The index of an array cell ranges from 1 to the length of the array minus 1. ____________________
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
18
To have two variables refer to two separate arrays that happen to contain the same values, copy all of the elements from one array to the other.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
19
The detection of a range-bound error is similar to the JVM's behavior when a program attempts to divide by zero.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
20
An enhanced for loop is simpler to write than a standard for loop with an index.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
21
Ravi must indicate an array's ____ in the loop when the array is not full.
A) logical size
B) first value
C) last value
D) physical length
A) logical size
B) first value
C) last value
D) physical length
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
22
When an object is used as a(n) ____ to a method, what gets passed is a reference to the object and not the object itself.
A) variable
B) element
C) initializer
D) parameter
A) variable
B) element
C) initializer
D) parameter
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
23
To access the ____ cell in an array, use the expression .length - 1
A) first
B) last
C) second to last
D) None of the above
A) first
B) last
C) second to last
D) None of the above
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
24
Arrays can be declared, instantiated, and initialized in one step. The list of numbers between the braces is called a(n) ____________________ list.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
25
Arrays are ____ and must be instantiated before being used.
A) values
B) variables
C) objects
D) strings
A) values
B) variables
C) objects
D) strings
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
26
The Boolean variable ____ is used to break out of a loop if a particular number is in an array.
A) break
B) found
C) stop
D) true
A) break
B) found
C) stop
D) true
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
27
An array with 20 ints that receives 5 ints from interactive input has a(n) ____ size of 5.
A) actual
B) physical
C) logical
D) variable
A) actual
B) physical
C) logical
D) variable
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
28
An array with 20 ints that receives 5 ints from interactive input has a(n) ____ size of 20.
A) actual
B) physical
C) logical
D) variable
A) actual
B) physical
C) logical
D) variable
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
29
A(n) ____ loop visits each element in an array from the first position to the last position.
A) enhanced for
B) initializer
C) logical
D) parallel
A) enhanced for
B) initializer
C) logical
D) parallel
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
30
Organizing code into two classes called the ____ and the view splits the code between managing the interface and manipulating the database.
A) model
B) GUI
C) application
D) widget
A) model
B) GUI
C) application
D) widget
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
31
FIGURE 10-2 
Alex is trying to find the first location of a value in the array. The variable loc initially equals ____.
A) null
B) -1
C) 0
D) 1

Alex is trying to find the first location of a value in the array. The variable loc initially equals ____.
A) null
B) -1
C) 0
D) 1
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
32
FIGURE 10-2 
In Figure 10-2 above, all of the following is true EXCEPT ____.
A) The method changes the student's name to Bill.
B) After the method finishes executing, the name is still Bill.
C) The actual and formal parameters do not refer to the same object.
D) Changes the method makes to the object's state are still in effect after the method terminates.

In Figure 10-2 above, all of the following is true EXCEPT ____.
A) The method changes the student's name to Bill.
B) After the method finishes executing, the name is still Bill.
C) The actual and formal parameters do not refer to the same object.
D) Changes the method makes to the object's state are still in effect after the method terminates.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
33
The ____ symbol on a button in a GUI interface moves to the first record in the database and displays its data.
A) 1
B) <<
C) >>
D) <
A) 1
B) <<
C) >>
D) <
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
34
FIGURE 10-1 
Figure 10-1 above shows ____.
A) two values referring to the same array variable
B) an array with two strings of values
C) an array with two names
D) two variables referring to the same array object

Figure 10-1 above shows ____.
A) two values referring to the same array variable
B) an array with two strings of values
C) an array with two names
D) two variables referring to the same array object
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
35
The ____ symbol on a button in a GUI interface moves to the last record in the database and displays its data.
A) [end]
B) <<
C) >>
D) <
A) [end]
B) <<
C) >>
D) <
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
36
The simplest way to add a data element to an array is to ____.
A) place it after the last available item
B) place it before the first available item
C) increase the physical size
D) increase the logical size
A) place it after the last available item
B) place it before the first available item
C) increase the physical size
D) increase the logical size
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
37
A(n) ____________________ is a data structure consisting of an ordered collection of similar items.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
38
If you want to keep a list of peoples' names and ages, you can use two arrays in which corresponding elements are related by using ____ arrays.
A) logical
B) double
C) duplicate
D) parallel
A) logical
B) double
C) duplicate
D) parallel
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
39
A(n) ____________________ is a loop that iterates through an array one element at a time.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
40
In a GUI, you should define a separate ____ class for each command button.
A) array
B) variable
C) listener
D) initializer
A) array
B) variable
C) listener
D) initializer
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
41
When an array is instantiated, each cell is ____________________ until reset to a new object.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
42
Identify the letter of the choice that best matches the phrase or definition.
a.Index
b.Range
c.Null
d.Count
e.Break
A subscript of a value of -1 results in a(n) ____-bound error.
a.Index
b.Range
c.Null
d.Count
e.Break
A subscript of a value of -1 results in a(n) ____-bound error.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
43
Identify the letter of the choice that best matches the phrase or definition.
a.Index
b.Range
c.Null
d.Count
e.Break
An item's position in an array.
a.Index
b.Range
c.Null
d.Count
e.Break
An item's position in an array.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
44
Identify the letter of the choice that best matches the phrase or definition.
a.Index
b.Range
c.Null
d.Count
e.Break
Failure to assign an array object can result in a(n) ____ pointer exception.
a.Index
b.Range
c.Null
d.Count
e.Break
Failure to assign an array object can result in a(n) ____ pointer exception.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
45
In a GUI, the ____________________ sets the title of the window, sets its closing action, and adds the widgets to the panels.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
46
Identify the letter of the choice that best matches the phrase or definition.
a.Index
b.Range
c.Null
d.Count
e.Break
This statement can be used to terminate an enhanced for loop early.
a.Index
b.Range
c.Null
d.Count
e.Break
This statement can be used to terminate an enhanced for loop early.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck
47
Identify the letter of the choice that best matches the phrase or definition.
a.Index
b.Range
c.Null
d.Count
e.Break
This variable could be used to track the number of items input.
a.Index
b.Range
c.Null
d.Count
e.Break
This variable could be used to track the number of items input.
Unlock Deck
Unlock for access to all 47 flashcards in this deck.
Unlock Deck
k this deck