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());
- A.
10,13,12
- B.
13,12,10
- C.
13,10,12
- D.
12,13,10
Attempted by 408 students.
Sign up free to check your answer
Sign up freeLoading lesson…