Chapter 8 Review Questions
Which of the following array declarations would be best suited for storing the retail prices?
Declare Real retailPrice[SIZE]
A declaration for a two-dimensional array requires only one size declarator.
False
Unlike variables, arrays need to be initialized separately from the declaration.
False
Some programming languages provide this specialized loop that steps through an array retrieving the value of each element.
For Each
What is the subscript for the data value 92 in the example given below?Declare Integer score [5] = 83, 92, 78, 94, 71
One
bounds
Programming languages perform array ___ checking, which means they do not allow a program to use an invalid array subscript
What is the term used for the number inside the bracket that specifies the number of values that an array can hold?
Size declarator
This is typically the last subscript in an array.
The size of the array minus one
Multiple-dimensional arrays can be used to model data that occurs in multiple sets.
True
To calculate the total of the values in an array, a loop is used with an accumulator variable.
True
How many subscripts do you need to access one element in a two-dimensional array?
Two
two-dimensional
a ___ array is like several identical arrays put together
data type
all the values in an array must be of the same ___
array
an ___ allows you to store a group of items of the same data type together in memory
A partially filled array is normally used with __________.
an accompanying integer variable that holds the number of items that are actually stored in the array
Processing a large number of items in a(n) ________ is usually easier than processing a large number of items stored in separate variables.
array
When working with arrays most programming languages perform ____________ which means they do not allow programs to use invalid subscripts.
array bounds checking
hen working with arrays most programming languages perform ____________ which means they do not allow programs to use invalid subscripts.
array bounds checking
list
arrays are designed to store and process a ___ of data
Many programming languages perform this, which means they do not allow a program to use an invalid array subscript.
bounds checking
subscripts
by using the same ___, a relationship can be established with the data stored between two or more arrays
To make programs easier to maintain, many programmers use these to specify the size of an array.
named constants
What type of error occurs when a loop iterates one time too few or one time too many?
off-by-one error
________________ arrays are two or more arrays that hold related data and the elements are accessed using a common subscript.
parallel
This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common subscript.
parallels arrays
two
passing an array as an argument requires that you pass ___ argument(s)
Two- dimensional arrays can be thought of as containing ___________.
rows and columns
You typically think of a two-dimensional array as containing
rows and columns
The expression score[5] is pronounced _____________________.
score sub 5
What is the term used for the value that is searched for in a search algorithm?
searchValue
Which is the simplest search technique to use to find an item in an array?
sequential
This algorithm uses a loop to step through each element of an array, starting with the first element, searching for a value.
sequential search
This appears in an array declaration and specifies the number of elements in the array.
size declarator
Every element in an array is assigned a unique number known as a ______________.
subscript
sequential
the ___ search algorithm stops when the item is found or the end of the array is reached
variable
the first step in finding the highest value in an array is to create a ___ to hold the highest value
zero
the first subscript in a one-dimensional array is ___
elements
the storage locations in an array are known as ___
[1,0]
the subscript of an element in a two-dimensional array that is in Row two and Column one is ___
Which of the following statement is true about the statement below? Declare Integer score [5] = 83, 92, 78, 94, 71
this is an array declaration and initialization
Array bounds checking happens at runtime, which is while the program is running.
true
Array bounds checking typically occurs while a program is running.
true
In most languages, an array's size cannot be changed while the program is running.
true
Subscripts are used to identify specific elements in an array.
true
The first step in calculating the average of the values in an array is to get the total of the values.
true
To calculate the total of the values in an array, a loop is used with an accumulator variable.
true
Variables work well in many situations, but they have limitations.
true
When processing the data in a two-dimensional array, each element has two subscripts.
true
subscript
using a loop's counter variable as a ___ makes it possible to perform the same action on each element in an array
data types
you cannot store a mixture of ___ in an array
two
declaring a two-dimensional array requires ___ size declarators
This is typically the first subscript in an array.
0
This is an individual storage location in an array.
element
A declaration for a two-dimensional array requires only one size declarator.
false
Arrays, like variables, can only hold one value at a time.
false
If array name contains a list of names, name[1] is the name of the first person.
false
In a sequential search algorithm, the Boolean variable used as a flag is initialized to TRUE.
false
One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types.
false
You can do many things with arrays, but you cannot pass one as an argument to a module or a function.
false
You can store a mixture of different data types in an array.
false
10
if the subscripts of an array go from 0 through 9, then the size of the array is ___
nonnegative
in most programming languages, an array size declarator must be a ___ integer
accumulator
loops are used to total the values in a numeric array, by which process the loop steps through the array adding the value of each array element to the ___