Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <queue>
    using namespace std;
    int main ()
    {
    priority_queue<int> QueueData;
    QueueData.push(12);
    QueueData.push(25);
    QueueData.push(13);
    cout << QueueData.top() << endl;
    return 0;
    }
    1. 12
    2. 25
    3. 13
    4. All of above
    5. None of these
Correct Option: B

In this program, We used the queue template and the top method is used to retain the last but before element.



Your comments will be displayed only after manual approval.