Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main ()
    {
    vector<int> FirstData (4, 2);
    vector<int> SecondData (6, 5);
    SecondData = FirstData;
    FirstData = vector<int>();
    cout << "Size of First Data " << int(FirstData.size()) << '\n';
    cout << "Size of Second Data " << int(SecondData.size()) << '\n';
    return 0;
    }
    1. Size of First Data 0
    2. Size of Second Data 4
      Size of First Data 0
    3. Size of First Data 0
      Size of Second Data 4
    4. Size of Second Data 4
    5. None of these
Correct Option: C

In this program, We are finding the size of the vector elements.



Your comments will be displayed only after manual approval.