Chapter 8 CIST 1305
Processing a large number of items in a(n) ________ is usually easier than processing a large number of items stored in separate variables. A ) Constant B ) Variable C ) Array D ) Loop E ) None of these
Array
Which of the following array declarations would be best suited for storing the retail prices? A ) Declare String retailPrice[SIZE] B ) Declare Real retailPrice[SIZE] C ) Declare Integer retailPrice[SIZE] D ) All of these E ) None of these
Declare Real retailPrice[SIZE]
*Arrays, like variables, can only hold one value at a time. A ) True B ) False
False
*Unlike variables, arrays need to be initialized separately from the declaration. A ) True B ) False
False
If array name contains a list of names, name[1] is the name of the first person. A ) True B ) False
False
In a sequential search algorithm, the Boolean variable used as a flag is initialized to TRUE. A ) True B ) False
False
One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types. A ) True B ) False
False
Some programming languages provide this specialized loop that steps through an array, retrieving the value of each element. A ) While Each B ) For Each C ) Repeat Get D ) Step Loop E ) None of these
For Each
*In the following declaration what is the data type of the elements of the array? Declare Integer numbers [SIZE] A ) SIZE B ) numbers C ) Integer D ) Declare E ) None of these
Integer
What type of error occurs when a loop iterates one time too few or one time too many? A ) Run time error B ) Off-by-one error C ) Validation error D ) Syntax error E ) All of these
Off-by-one error
What is the subscript for the data value 92 in the example given below? Declare Integer score [5]= 83, 92, 78, 94, 71 A ) One B ) Two C ) A D ) B E ) None of these
One
A three-dimensional array can be thought of as ________ of two-dimensional arrays. A ) Rows B ) Columns C ) Lines D ) Pages E ) None of these
Pages
*________ arrays are two or more arrays that hold related data, and the elements are accessed using a common subscript. A ) Sequential B ) Binary C ) Parallel D ) Linear E ) None of these
Parallel
Two-dimensional arrays can be thought of as containing ________. A ) Rows and columns B ) Lines and pages C ) Rows and lines D ) Lines and columns E ) Rows and pages
Rows and columns
*The expression score[5] is pronounced ________. A ) Score of 5 B ) Score 5 C ) Score sub 5 D ) Score of 4 E ) Score sub 4
Score sub 5
*Which is the simplest search technique to use to find an item in an array? A ) Sequential B ) Binary C ) Bubble D ) Select E ) None of these
Sequential
What is the term used for the number inside the bracket that specifies the number of values that an array can hold? A ) Size B ) Size declarator C ) Number D ) Number declarator E ) None of these
Size declarator
Access the individual elements in an array by using their ________. A ) Sizes B ) Numbers C ) Integers D ) Subscripts E ) None of these
Subscripts
*Which of the following arguments must be passed when passing an array as an argument? A ) The array itself B ) An integer that specifies the number of elements in the array C ) The data type of the array D ) The array itself and An integer that specifies the number of elements in the array E ) The array itself and The data type of the array
The array itself and An integer that specifies the number of elements in the array
*Which of the following statement is true about the statement below? Declare Integer score [5] = 83, 92, 78, 94, 71 A ) This is an array declaration. B ) This is an array initialization. C ) This is an array size establishment. D ) This is an array declaration and initialization. E ) This is an array declaration and size establishment.
This is an array declaration and initialization.
Array bounds checking happens at runtime, which is while the program is running. A ) True B ) False
True
Multiple-dimensional arrays can be used to model data that occurs in multiple sets. A ) True B ) False
True
Subscripts are used to identify specific elements in an array. A ) True B ) False
True
The first step in calculating the average of the values in an array is to get the total of the values. A ) True B ) False
True
To calculate the total of the values in an array, a loop is used with an accumulator variable. A ) True B ) False
True
Variables work well in many situations, but they have limitations. A ) True B ) False
True
When processing the data in a two-dimensional array, each element has two subscripts. A ) True B ) False
True
*How many subscripts do you need to access one element in a two-dimensional array? A ) One B ) Two C ) Three D ) Four E ) None of these
Two
A partially filled array is normally used with ________. A ) a library function that performs array insertions B ) an accompanying variable that holds a copy of the last item stored in the array C ) an accompanying integer variable that holds the number of items that are actually stored in the array D ) a warning to the user that some of the elements contain invalid values E ) None of these
an accompanying integer variable that holds the number of items that are actually stored in the array
*When working with arrays, most programming languages perform ________, which means they do not allow programs to use invalid subscripts. A ) array bounds checking B ) buffer overrun protection C ) bitwise data execution D ) subscript binding E ) None of these
array bounds checking
What is the term used for the value that is searched for in a search algorithm? A ) stringValue B ) searchValue C ) matchValue D ) flag E ) None of these
searchValue
Every element in an array is assigned a unique number known as a ________. A ) subscript B ) integer C ) character D ) number E ) None of these
subscript