Arrays are always indexed starting at subscript ________.
0
1
“start”
“begin”
How many integers can the array named numbers contain?
int numbers[10];
11
9
10
Which of the following is a legal array definition in C++?
int numbers[0];
double 5numbers[5];
real numbers[5];
float numbers[10];
C++ treats an array name as:
all of the array elements
a variable
the location in memory of first array element
the first array element
All array elements must be:
enclosed in square brackets [ ]
constants
literals
of the same type
Given the following array declaration, how would you display 100.7 from the array?
100.7
double temperatures[] = {98.6, 95.2, 88.7, 100.7, 89.0};
cout << temperatures[4] << endl;
cout << 100.7 << endl;
cout << temps[3] << endl;
cout << temperatures[3] << endl;
Given the following array declaration, what would the following code display?
double temperatures[] {98.6, 95.2, 88.7, 100.7, 89.0}; cout << temperatures[5] << endl;
garbage data
89.0
it won’t compile
it will generate an “out of range error”
How would you define a vector named temperatures that contains doubles?
vector<double> temperatures;
vector double temperatures;
vector[double] temperatures;
double vector temperatures
How would you determine the number of elements contained in a vector named temperatures?
length(temperatures);
temperatures.length();
temperatures.size();
temperatures.num_elements();
What is one way that vectors and arrays are different?
vectors always more efficient than arrays
arrays can only store primitive types
vectors can vary their capacity as the program runs, but arrays are fixed in size
vectors elements cannot be accessed using their subscript