Ask Question
8 November, 01:21

What does the following statement do? vector v (10, 2);

A) It creates a vector object and initializes all the first two elements with the values 10 and 2.

B) It creates a vector object with a starting size of 2 and the first element initialized with the value 10.

C) It creates a vector object with a starting size of 10 and the first element initialized with the value 2.

D) It creates a vector object with a starting size of 10 and all elements are initialized with the value 2.

+4
Answers (1)
  1. 8 November, 01:29
    0
    D) It creates a vector object with a starting size of 10 and all elements are initialized with the value 2.

    Explanation:

    When you write the statement vector v (10,2); This statement declares a vector or dynamic array of size 10 that is the first parameter and the second parameter is the value with which all the elements in the vector are to be initialized. So in this vector all the 10 values will be initialized with the value 2. It is one of the way of initializing the vector.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What does the following statement do? vector v (10, 2); A) It creates a vector object and initializes all the first two elements with the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers