question 1: How do you specify what type the vector will hold? When declaring it
ID: 3918188 • Letter: Q
Question
question 1:
How do you specify what type the vector will hold?
When declaring it: double bob-vector;
You don't need to specify, C++ will automatically deduce the type when it is used.
Whatever is inside the <> as in vector<int>
By casting all types to be in the vector type.
QUESTION 2
Given:
int array[10] = {1};
cout << array[4] << endl;
Will it print out the value of 1?
True False
QUESTION 3
An array of string objects to hold 5 names would be declared using which statement?
strings names5;
string names(5);
String[5] names;
None of these
string names[5];
QUESTION 4
What is the maximum size a vector can grow to?
8 MB
1 MB
1 million items.
The limit is how much memory your computer has.
QUESTION 5
Which is valid way to pass the following array to a function?
int array1[9] = {0};
ProcessArray(array1[9]);
ProcessArray(array1)
ProcessArray(array1[0]);
ProcessArray(&array1);
QUESTION 6
What does the following statement do?
It creates a vector object with a starting size of 10 and the first value initialized to 2
It creates a vector object and a initializes the first two values to 10 and 2
It creates a vector object with a starting size of 10 and all elements initialized to a value of 2
QUESTION 7
A C++ array is automatically initialized to the value of zero?
True False
QUESTION 8
Which of the following correct defines a vector object for holding integers?
vector <int> v;
int vector array[10];
int vector v;
vector v<int>;
QUESTION 9
To access an array element, use the array name and the element's __________________ .
name
subscript
None of these
value
data type
QUESTION 10
What is the first legal subscript that can be used with the following arrary?
double array1[10];
1
9
0
10
None of these
When declaring it: double bob-vector;
You don't need to specify, C++ will automatically deduce the type when it is used.
Whatever is inside the <> as in vector<int>
By casting all types to be in the vector type.
Explanation / Answer
1) Whatever is inside the as in vector 2) False 3) string names[5]; 4) The limit is how much memory your computer has. 5) ProcessArray(array1)Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.