x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

The stack follows First In First Out principle. When a,b and c are pushed then c is at the top (Current stack: a,b,c,_,_). When f is pushed then f is at the top (Current Stack: a,b,c,f,_). Popping will remove top element, so f is removed (Current Stack: a,b,c,_,_). When h is pushed then h is at the top (Current Stack: a,b,c,h,_). Popping will remove top element, so h is removed (Current Stack: a,b,c,_,_). When m is pushed then m is at the top (Current Stack: a,b,c,m,_). Popping will remove top element, so m is removed. Final Stack: a,b,c,_,_ with c at the top and 2 empty positions.

Answer
A, B, C are pushed. Then f is pushed. Total 4 location is full, then one pop operation. Thus, for is popped. Stack now contains a, B, C. Then h is pushed and popped. Finally m is pushed and popped. Thus stack now contains only a, B, C and 3 locations are occupied. Top 2 locations are free.

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer