Quiz 7 C++

12 September 2022
4.7 (114 reviews)
50 test answers

Unlock all answers in this set

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