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.
deque mydeque;
8.
mydeque.push_back (100);
9.
mydeque.push_back (200);
10.
mydeque.push_back (300);
11.
for(deque :: iterator it = mydeque.begin(); it != mydeque.end(); ++it)
12.
{
13.
}
14.
mydeque.clear();
15.
mydeque.push_back (110);
16.
mydeque.push_back (220);
17.
for(deque :: iterator it = mydeque.begin(); it != mydeque.end(); ++it)
18.
cout
Options:
A .  110
B .  220
C .  Both a & b
D .  None of the mentioned
Answer: Option C

In this program, We cleared the old values presented in the dequeue with the new values.
Output:
$ g++ seq2.cpp
$ a.out
110 220



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers