adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <vector>
    using namespace std;
    int main()
    {
        vector<int> v;
        v.assign( 10, 42 );
        for (int i = 0; i < v.size(); i++) 
        {
            cout << v[i] << " ";
        }
    }

a.

42

b.

42 42

c.

424

d.

42 for 10 times

Answer: (d).42 for 10 times

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?