Object-Oriented Approach to Program-
ming Logic and Design 4th Edition
Joyce Farrell Test Bank
Full download at link:
Test Bank: https://testbankpack.com/p/test-bank-for-object-ori-
ented-approach-to-programming-logic-and-design-4th-edition-
joyce-farrell-1133188222-9781133188223/
Solution Manual: https://testbankpack.com/p/solution-manual-for-
object-oriented-approach-to-programming-logic-and-design-4th-
edition-joyce-farrell-1133188222-9781133188223/
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.
ANS: T PTS: 1 REF: 159
2. An error commonly made by beginning programmers is to forget that array subscripts start with the
integer 1.
ANS: F PTS: 1 REF: 160
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.
ANS: T PTS: 1 REF: 160
4. Each variable within an array has the same name and the same data type.
ANS: T PTS: 1 REF: 160
5. Many programming languages allow you to initialize an array with fewer values than there are array
elements declared.
ANS: T PTS: 1 REF: 161
6. Sometimes the values stored in arrays should be constants.
ANS: T PTS: 1 REF: 171
7. A flag is a variable you set to indicate whether some event occurred.
ANS: T PTS: 1 REF: 174
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.
ANS: T PTS: 1 REF: 175
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.
ANS: T PTS: 1 REF: 186
10. Leaving a loop as soon as a match is found improves the program’s efficiency.
ANS: T PTS: 1 REF: 179
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
3. Some programmers refer to an array as a table, or a ____.
a. catalog c. matrix
b. template d. list
ANS: C 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
5. Arrays are always composed of elements of the same data ____.
a. type c. method
b. style d. mode
ANS: A PTS: 1 REF: 160
6. What is another word for a subscript?
a. superscript c. variable
b. subroutine d. index
ANS: D PTS: 1 REF: 160
7. Each separate array variable is one ____ of an array.
a. element c. factor
b. block d. aspect
ANS: A 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
10. Any array’s subscripts are always a sequence of ____.
a. alphanumeric characters c. links
b. symbols d. integers
ANS: D 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
14. An array can best be used to replace what type of structure?
a. flowchart c. sequence
b. selection d. nested decision
ANS: D PTS: 1 REF: 162
15. Using an array is never ____.
a. mandatory c. a good idea
b. optional d. easy to understand
ANS: A PTS: 1 REF: 170
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
20. Leaving a loop as soon as a match is found ____ a program’s efficiency.
a. worsens c. doesn’t change
b. improves d. defines
ANS: B PTS: 1 REF: 179
21. A ____ is any series of contiguous values between specified limits.
a. parallel array c. bounded series
b. range of values d. subscript search
ANS: B PTS: 1 REF: 181
22. Every array has a(n) ____ size.
a. finite c. indefinite
b. infinite d. large
ANS: A PTS: 1 REF: 184
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
25. The highest usable array subscript is ____.
a. twice the size of the array c. one more than the size of the array
b. the size of the array d. one less than the size of the array
ANS: D PTS: 1 REF: 186
COMPLETION
1. The ____________________ is considered to be one of the most useful data structures.
ANS: array
PTS: 1 REF: 159
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
PTS: 1 REF: 160
3. Providing array values is also called ____________________ the array.
ANS:
populating
initializing
PTS: 1 REF: 160
4. If an array has valid subscripts from 0 to 4, the size of the array is ____________________.
ANS:
5
five
PTS: 1 REF: 160
5. To access an array element in Java, you place the subscript inside ____________________.
ANS:
square brackets
brackets
[]
PTS: 1 REF: 160
6. Subscripts are always a sequence of ____________________.
ANS: integers
PTS: 1 REF: 160
7. ____________________ the array involves providing values for elements of the array.
ANS:
Populating
Initializing
PTS: 1 REF: 160
8. The first subscript in an array is ____________________.
ANS:
0
zero
PTS: 1 REF: 160
9. Arrays are often useful for replacing ____________________ decisions.
ANS: nested
PTS: 1 REF: 162
10. When you search a list from one end to the other, it is called a(n) ____________________ search.
ANS:
linear
sequential
PTS: 1 REF: 172
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
PTS: 1 REF: 175
13. ____________________ arrays are most useful when value pairs have an indirect relationship.
ANS: Parallel
PTS: 1 REF: 179
14. A(n) ____________________ search starts looking in the middle of a sorted list then determines
whether it should continue higher or lower.
ANS: binary
PTS: 1 REF: 180
15. A(n) ____________________ is out of bounds when it is not in the range of acceptable values.
ANS: subscript
PTS: 1 REF: 186