Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
int main ()
5.
{
6.
unsigned int i;
7.
vector first;
8.
vector second (4, 100);
9.
vector third (second.begin(), second.end());
10.
vector fourth (third);
11.
int myints[] = {16, 2, 77, 29};
12.
vector fifth (myints, myints + sizeof(myints) / sizeof(int) );
13.
for (vector :: iterator it = fifth.begin(); it != fifth.end(); ++it)
14.
cout
Options:
A .  16
B .  16 2
C .  16 2 77
D .  16 2 77 29
Answer: Option D

In this program, We got the values and printing it by using the vector and we are contructing vectors.
Output:
$ g++ vect.cpp
$ a.out
16 2 77 29



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