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
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 | ||
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?
a. | strings names5; | b. | string names(5); | c. | String[5] names; | d. | None of these | e. | 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};
a. | ProcessArray(array1[9]); | b. | ProcessArray(array1) | c. | ProcessArray(array1[0]); | d. | ProcessArray(&array1); |
QUESTION 6
What does the following statement do?
vectorv(10,2)
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 vector array[10]; | ||
int vector v; | ||
vector v |
QUESTION 9
To access an array element, use the array name and the element's __________________ .
a. | name | b. | subscript | c. | None of these | d. | value | e. | data type |
QUESTION 10
What is the first legal subscript that can be used with the following arrary?
double array1[10];
a. | 1 | b. | 9 | c. | 0 | d. | 10 | e. | None of these |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started