Home » C++ Programming » Standard Library » Question
  1. What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main()
    {
    vector<int> vect;
    vect.assign( 5, 50 );
    for (int k = 0; k < vect.size(); k++)
    {
    cout << vect[k] << " ";
    }
    }
    1. 50
    2. 50 50
    3. 50 50 50
    4. 50 50 50 50
    5. 50 50 50 50 50
Correct Option: E

In this program, We used the vector to print the 50 for 5 times.



Your comments will be displayed only after manual approval.