What is the output of the following program? Queue q =new Queue(); Stack s =…

What is the output of the following program?

Queue q =new Queue();

Stack s = new Stack();

S.push(new Integer(12));

S.push (new interger(13));

S.push(new integer(10));

q.enqueue(s.pop());

q.enqueue(new integer(12));

q.enqueue(new integer(13));

S.push(q.dequeue());

System.out.print(s.pop());

System.out.print(s.pop());

System.out.print(s.pop());

  1. A.

    10,13,12

  2. B.

    13,12,10

  3. C.

    13,10,12

  4. D.

    12,13,10

Attempted by 408 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…