Ask 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 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.

+3
Answers (1)
  1. 29 July, 22:03
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers