Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <deque>
    using namespace std;
    int main ()
    {
    unsigned int k;
    deque<int< Data;
    deque<int> :: iterator Iter;
    Data.push_back ( 202 );
    Data.push_back ( 303 );
    Data.push_back ( 404 );
    for (Iter = Data.begin(); Iter != Data.end(); ++Iter)
    Data.clear();
    cout << ' ' << *Iter;
    }
    1. 202
    2. 303
    3. 404
    4. Segmentation fault
    5. None of these
Correct Option: D

Errors will arise because we are clearing all the queue values before printing it.



Your comments will be displayed only after manual approval.