COP3014 - Chapter 7 Multiple Choice
Arrays must be __________ at the time they are __________.
compiled, typed
An array can easily be stepped through by using a
for loop
An array with no elements is
illegal in C++
This following statement shows an example of ___________. int grades][ ] = {100, 90, 99, 80};
implicit array sizing
A(n) __________ can be used to specify the starting values of an array.
initialization list
Which of the following is a valid C++ array definition?
int scores[25];
Unlike regular variables, __________ can hold multiple values.
arrays
The individual values contained in an array are known as
elements
Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.
false
An array initialization must be all on one line.
false
The name of an array stores the __________ of the first array element.
memory address
When you pass an array as an argument to a function, the function can modify the contents of the array.
true
C++ limits the number of array dimensions to two.
false
If you attempt to store data past an array's boundaries, it is guaranteed to cause a compiler error.
false
In C++11 the range-based for loop is best used in situations where you need the element subscript for some purpose.
false
The following statement is a valid C++ definition: double money[25.00];
false
Given the following declaration, where is the value 77 stored in the scores array? int scores[] = {83, 62, 77, 97, 86}
scores[2]
By using the same ___________ you can build relationships between data stored in two or more arrays.
subscript
To access an array element, use the array name and the element's ___________.
subscript
What is the last legal subscript that can be used with the following array? int values[5];
4
Subscript numbering in C++
begins with zero
An array's size declarator must be a __________ with a value greater than __________.
constant integer expression, zero
Assume array1 and array2 are the names of two arrays. To assign the contents of array2 to array1, you would use the following statement: array1 = array2;
false
The range-based for loop in C++11 is designed to work with a built-in variable known as
the range variable
Which of the following is a valid C++ array definition?
int sizes[10];
It is _________ to pass an argument to a function that contains an individual array element, such as scores[3].
legal in C++
An array can store a group of values, but the values must be
the same data type
A vector object automatically expands in size to accommodate the items stored in it.
true
An individual array element can be processed like any other type of C++ variable.
true
Each individual element of an array can be accessed by the array name and the element subscript.
true
If an array is partially initialized, the uninitialized elements will be set to zero.
true
In C++11 you cannot use a range-based for loop to modify the contents of an array unless you declare the range variable as a reference variable.
true
The amount of memory used by an array depends on the array's data type and the number of elements in the array.
true
If you leave out the size declarator in an array definition
you must furnish an initialization list