Sail E0 Webinar
Question


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
Options:
A .  42
B .  42 42
C .  424
D .  42 for 10 times
Answer: Option D

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 ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

More Questions on This Topic :

Latest Videos

Latest Test Papers