Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <deque>
    using namespace std;
    int main ()
    {
    deque<int> Data;
    int Addition (0);
    Data.push_back ( 35 );
    Data.push_back ( 56 );
    Data.push_back ( 44 );
    while (!Data.empty())
    {
    Addition += Data.back();
    Data.pop_back();
    }
    cout << Addition << '\n';
    return 0;
    }
    1. 35
    2. 56
    3. 44
    4. 135
    5. None of these
Correct Option: D

In this program, We are adding all the values in the queue.



Your comments will be displayed only after manual approval.