adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <queue>
    using namespace std;
    int main ()
    {
        priority_queue<int> mypq;
        mypq.push(30);
        mypq.push(100);
        mypq.push(25);
        mypq.push(40);
        while (!mypq.empty())
        {
            cout << " " << mypq.top();
            mypq.pop();
        }
        cout << endl;
        return 0;
    }

a.

100 40 30 25

b.

100 40 30

c.

100 40

d.

None of the mentioned

Answer: (a).100 40 30 25

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?