Question
1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
vector v;
7.
v.assign( 10, 42 );
8.
for (int i = 0; i < v.size(); i++)
9.
{
10.
cout
What is the output of this program?
1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
vector v;
7.
v.assign( 10, 42 );
8.
for (int i = 0; i < v.size(); i++)
9.
{
10.
cout
Answer: Option D
Was this answer helpful ?
In this program, We used the vector to print the 42 for 10 times.
Output:
$ g++ std.cpp
$ a.out
42 42 42 42 42 42 42 42 42 42
Was this answer helpful ?
Submit Solution