Chapter 7 Quiz
how many elements does the following array have? int values[1000];
1000
the 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];
the name of an array stores the _____ of the first array element
memory address
to pass an array as an argument to a function, pass the ____ of the array
name
this vector function returns the number of elements in a vector
size
an array of string objects that will hold five names would be declared with which of the following statements?
string names[5];
a two-dimensional array of characters can contain
strings of the same length, strings of different lengths, uninitialized elements
by using the same _____ you can build relationships between data stored in two or more arrays
subscript
a two-dimensional array can have elements of ____ data types
one
what will the following C++ code display? vector <int> numbers {3, 5}; for(int val : numbers) cout << val << endl;
3 5
what will the following code display? int numbers[] = {99, 87, 66, 55, 101}; cout << numbers[3] << endl;
55
subscript numbering in C++
begins with zero
what does the following statement do? vector <int> v(10);
creates a vector objects with a starting size of 10
this vector function returns true if the vector has no elements
empty
an array can easily be stepped through by using a _____
for loop
this vector function is used to insert an item into a vector
push_back
which statement correctly defines a vector objects for holding integers?
vector <int> v;
if you leave out the size declarator in an array definition:
you must furnish an initialization list