Object-Oriented Approach To Programming Logic and Design 4th Edition Joyce Farrell Test Bank 1
Object-Oriented Approach To Programming Logic and Design 4th Edition Joyce Farrell Test Bank 1
Chapter 5: Arrays
TRUE/FALSE
1. If you store important papers in a series of file folders and label each folder with a consecutive letter of
the alphabet, then you are using the equivalent of an array.
2. An error commonly made by beginning programmers is to forget that array subscripts start with the
integer 1.
3. Depending on the syntax rules of the programming language you use, you place the subscript within
parentheses or square brackets following the group name.
4. Each variable within an array has the same name and the same data type.
8. Parallel arrays are two arrays such that each element in one array is associated with the element in the
same relative position in the other array.
9. As with a while loop, when you use a for loop, you must be careful to stay within array bounds,
remembering that the highest usable array subscript is one less than the size of the array.
10. Leaving a loop as soon as a match is found improves the program’s efficiency.
MULTIPLE CHOICE
1. A(n) ____ is a series or list of variables in computer memory, all of which have the same name and
data type but are differentiated with special numbers called subscripts.
a. collection c. script
b. array d. group
ANS: B PTS: 1 REF: 159
2. Whenever you require ____ storage locations for objects, you are using a real-life counterpart of a
programming array.
a. multiple c. stacked
b. fixed d. expandable
ANS: A PTS: 1 REF: 159
4. A ____, also called an index, is a number that indicates the position of a particular item within an
array.
a. superscript c. placeholder
b. key d. subscript
ANS: D PTS: 1 REF: 160
8. Each array element occupies an area in memory next to, or ____, the others.
a. coupled with c. contiguous to
b. associated with d. parallel with
ANS: C PTS: 1 REF: 160
9. All array elements have the same ____ name, but each individual element also has a unique subscript
indicating how far away it is from the first element.
a. variable c. superscript
b. group d. value
ANS: B PTS: 1 REF: 160
11. When you declare an array, you provide a(n) ____ name for a number of associated variables in
memory.
a. permanent c. group
b. immutable d. standard
ANS: C PTS: 1 REF: 160
12. In C++ and C#, which type of punctuation is used to hold the array’s subscript following the group
name?
a. square brackets c. parenthesis
b. asterisks d. quotes
ANS: A PTS: 1 REF: 160
13. Initializing an array with a number of elements ____ the array’s size is not allowed in any
programming language.
a. fewer than c. greater than or equal to
b. more than d. less than or equal to
ANS: B PTS: 1 REF: 161
16. In Visual Basic, if you declare an array named count, its size is stored in what constant?
a. count.size c. count.length
b. count.Length d. count.ElementNumber
ANS: B PTS: 1 REF: 171
17. A(n) ____ is the process of searching through a list from one end to another.
a. binary search c. linear search
b. array search d. midpoint search
ANS: C PTS: 1 REF: 172
18. A ____ is a variable that you set to indicate whether some event has occurred.
a. banner c. sentinel
b. sentry d. flag
ANS: D PTS: 1 REF: 174
19. Two corresponding arrays are known as ____ arrays when each element in one array is associated with
the element in the same relative position in the other array.
a. perpendicular c. similar
b. parallel d. matching
ANS: B PTS: 1 REF: 175
23. When you use a subscript not within the range of acceptable subscripts, your subscript is said to be
____.
a. out of range c. out of bounds
b. out of area d. out of series
ANS: C PTS: 1 REF: 186
24. Users enter incorrect data frequently; a good program should be able to handle the mistake and not
allow the ____ to be out of bounds.
a. subscript c. range
b. superscript d. variable
ANS: A PTS: 1 REF: 186
COMPLETION
ANS: array
2. All of the variables in an array have the same name and data type but are differentiated with special
numbers called ____________________.
ANS:
subscripts
indices
subscript
index
a subscript
an index
ANS:
populating
initializing
4. If an array has valid subscripts from 0 to 4, the size of the array is ____________________.
ANS:
5
five
5. To access an array element in Java, you place the subscript inside ____________________.
ANS:
square brackets
brackets
[]
ANS: integers
7. ____________________ the array involves providing values for elements of the array.
ANS:
Populating
Initializing
ANS:
0
zero
ANS: nested
10. When you search a list from one end to the other, it is called a(n) ____________________ search.
ANS:
linear
sequential
11. A(n) ____________________ is a variable set to indicate whether some event has occurred.
ANS: flag
PTS: 1 REF: 174
12. ____________________ arrays are two or more arrays in which each element in one array is
associated with the element in the same relative position in the other array(s).
ANS: Parallel
13. ____________________ arrays are most useful when value pairs have an indirect relationship.
ANS: Parallel
14. A(n) ____________________ search starts looking in the middle of a sorted list then determines
whether it should continue higher or lower.
ANS: binary
15. A(n) ____________________ is out of bounds when it is not in the range of acceptable values.
ANS: subscript