Unlike regular variables, these can hold multiple values. |
The correct answer is: arrays |
The individual values contained in array are known as ________. |
The correct answer is: elements |
To access an array element, use the array name and the element’s ________. |
The correct answer is: subscript |
Which of the following is a valid C++ array definition? |
The correct answer is: int array[10]; |
The statement: int grades [] = {100, 90, 99, 80}; shows an example of: |
The correct answer is: implicit array sizing |
By using the same ________ you can build relationships between data stored in two or more arrays. |
The correct answer is: subscript |
The name of an array stores the ________ of the first array element. |
The correct answer is: memory address |
A two-dimensional array is like ________ put together. |
The correct answer is: several identical arrays |
A two-dimensional array can be viewed as ________ and ________. |
The correct answer is: rows, columns |
If you leave out the size declarator in an array definition: |
The correct answer is: you must furnish an initialization list |
Which of the following is a valid C++ array definition? |
The correct answer is: int scores [10]; |
An element of a two-dimensional array is referred to by ________ followed by ________. |
The correct answer is: the row subscript of the element, the column subscript of the element |
When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list. |
The correct answer is: all but the first dimension |
An array can store a group of values, but the values must be: |
The correct answer is: the same data type |
An array’s size declarator must be a ________ with a value greater than ________. |
The correct answer is: constant integer expression, zero |
Subscript numbering in C++________. |
The correct answer is: begins with zero |
Arrays may be ________ at the time they are ________. |
The correct answer is: initialized, declared |
Given the following declaration, where is the value 77 stored in the scores array? |
The correct answer is: scores[2] |
An array can easily be stepped through by using a ________. |
The correct answer is: for loop |
The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________. |
The correct answer is: range variable |
To assign the contents of one array to another, you must use ________. |
The correct answer is: a loop to assign the elements of one array to the other array |
To pass an array as an argument to a function, pass the ________ of the array. |
The correct answer is: name |
A two-dimensional array can have elements of ________ data type(s). |
The correct answer is: one |
A two-dimensional array of characters can contain ________. |
The correct answer is: All of these |
ANo ________ can be used to specify the starting values of an array. |
The correct answer is: initialization list |
The ________ is automatically appended to a character array when it is initialized with a string constant. |
The correct answer is: null terminator |
An array with no elements is ________. |
The correct answer is: illegal in C++ |
An array of string objects that will hold 5 names would be declared using which statement? |
The correct answer is: string names[5]; |
It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3]. |
The correct answer is: legal in C++ |
What is the last legal subscript that can be used with the following array? |
The correct answer is: 4 |
How many elements does the following array have? |
The correct answer is: 1000 |
What will the following code display? |
The correct answer is: 55 |
What will the following code display? |
The correct answer is: 87 66 55 |
What will the following code display? |
The correct answer is: 0 |
What will the following code do? |
The correct answer is: An error will occur when the code runs |
Which statement correctly defines a vector object for holding integers? |
The correct answer is: vector<int> v; |
Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20? |
The correct answer is: vector<int> n { 10, 20 }; |
What does the following statement do? |
The correct answer is: It creates a vector object with a starting size of 10. |
What will the following C++ 11 code display? |
The correct answer is: 3 5 |
What does the following statement do? |
The correct answer is: It creates a vector object with a starting size of 10 and all elements are initialized with the value 2. |
This vector function is used to insert an item into a vector. |
The correct answer is: push_back |
This vector function returns the number of elements in a vector. |
The correct answer is: size |
This vector function removes an item from a vector. |
The correct answer is: pop_back |
This vector function returns true if the vector has no elements. |
The correct answer is: empty |
True/False: The amount of memory used by an array depends upon the array’s data type and the number of elements in the array. |
The correct answer is ‘True’. |
True/False: An array initialization list must be placed on one single line. |
The correct answer is ‘False’. |
True/False: When you pass an array as an argument to a function, the function can modify the contents of the array. |
The correct answer is ‘True’. |
True/False: If you attempt to store data past an array’s boundaries, it is guaranteed that the compiler will issue an error. |
The correct answer is ‘False’. |
True/False: 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. |
The correct answer is ‘True’. |
True/False: Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function. |
The correct answer is ‘False’. |
Quiz 7 C++
Share This
Unfinished tasks keep piling up?
Let us complete them for you. Quickly and professionally.
Check Price