Wednesday, 20 May 2015

Q40,paper 2,D12.Given an empty stack, after performing push (1), push (2), Pop, push (3), push (4), Pop, Pop, push(5), Pop, what is the value of the top of the stack ?


(A) 4
(B) 3
(C) 2
(D) 1.
Answer© Explanation .
push (1), push (2), Pop, push (3), push (4).
Stack contents (1,2,3,4*)
After pop,pop
Stack contents (1,2*)
Push 5
Stack contents(125*)
Pop
Stack contents are (12*).
Top of stack is 2.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.