Ask Question
22 August, 19:32

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. 22 August, 22:44
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers