Quiz 7

Unlike regular variables, these can hold multiple values.
arrays
The individual values contained in array are known as ________.
elements
We will write a custom essay sample on
Quiz 7
or any similar topic only for you
Order now
To access an array element, use the array name and the element’s ________.
subscript
Which of the following is a valid C++ array definition?
int array[10];
The statement:

int grades[] = {100, 90, 99, 80}
is an example of:

implicit array sizing
By using the same ________ you can build relationships between data stored in two or more arrays.
subscript
The name of an array stores the ________ of the first array element.
memory address
A two-dimensional array is like ________ put together.
several identical arrays
A two-dimensional array can be viewed as ________ and ________.
rows, columns
If you leave out the size declarator in an array definition:
you must furnish a initialization list
Which of the following is a valid C++ array definition?
int scores[10];
An element of a two-dimensional array is referred to by ________ followed by ________.
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.
all but the first dimension
An array can store a group of values, but the values must be:
the same data type
An array’s size declarator must be a ________ with a value greater than ________.
constant integer expression, zero
Subscript numbering in C++________.
begins with zero
Arrays may be ________ at the time they are ________.
initialized, declared
Given the following declaration, where is the value 77 stored in the scores array?

int scores[] = {83, 62, 77, 97};

scores[2]
An array can easily be stepped through by using a ________.
for loop
The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________.
range variable
To assign the contents of one array to another, you must use ________.
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.
name
A two-dimensional array can have elements of ________ data type(s).
one
A two-dimensional array of characters can contain ________.
strings of the same length
strings of different lengths
uninitialized elements
A(n) ________ can be used to specify the starting values of an array.
initialization list
The ________ is automatically appended to a character array when it is initialized with a string constant.
null terminator
An array with no elements is ________.
illegal in C++
An array of string objects that will hold 5 names would be declared using which statement?
string names[5];
It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].
legal in C++
What is the last legal subscript that can be used with the following array?
4
How many elements does the following array have?

int bugs[1000];

1000
What will the following code display?

int numbers[] = {99, 87, 66, 55, 101}
cout << numbers[3] << endl;

55
What will the following code display?

int numbers[] = {99, 87, 66, 55, 101}
for (int i = 1; i < 4; i++) cout << numbers[i] << endl;

87
66
55
What will the following code do?
const int SIZE = 5;
double x[SIZE];
for (int i = 2; i <= SIZE; i++) { x[i] = 0.0; }
an error will occur when the code runs
Which statement correctly defines a vector object for holding integers?
vector v;
Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?
vector n{10,20};
What does the following statement do?
vector v(10);
It creates a vector object with a starting size of 10.
What will the following C++ 11 code display?
vector numbers { 3 , 5 };
for (int val : numbers)
cout << val << endl;
3
5
What does the following statement do?
vector v(10, 2);
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.
push_back
This vector function returns the number of elements in a vector.
size
This vector function removes an item from a vector.
pop_back
This vector function returns true if the vector has no elements.
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.
True
True/False: An array initialization list must be placed on one single line.
False
True/False: When you pass an array as an argument to a function, the function can modify the contents of the array.
True
True/False: If you attempt to store data past an array’s boundaries, it is guaranteed that the compiler will issue an error.
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.
True
True/False: Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.
False
×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out