Examveda
Examveda

What will be the output of the following C++ code?
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
    queue<char> q;
    q.push('a');
    q.push('b');
    q.push('c');
    cout << q.front();
    q.pop();
    cout << q.front();
    q.pop();
    cout << q.front();
    q.pop();
}

A. ab

B. abc

C. a

D. error

Answer: Option B


Join The Discussion

Related Questions on Standard Template Library (STL) in C plus plus