in DS retagged by
4,710 views
4 votes
4 votes

Consider the following operations performed on a stack of size 5:

Push (a); Pop(); Push(b); Push(c); Pop();

Push(d); Pop(); Pop(); Push(e)

Which of the following statements is correct?

  1. Underflow occurs
  2. Stack operations are performed smoothly
  3. Overflow occurs
  4. None of the above
in DS retagged by
4.7k views

1 Answer

2 votes
2 votes
Given stack size = 5

Operation                                Stack contents

push(a)                                            a

pop()                                                -

push(b)                                            b

push(c)                                            b,c

pop()                                               b

push(d)                                           b,d

pop()                                              b

pop()                                               -

push(e)                                          e       

Option B.
edited by
Answer:

Related questions