GATE / CS ARCHIVE

GATE CSE 2015 SET 3 / QUESTION 28

GATE CSE 2015 Set 3 Q28

Data Structures · Stacks & Queues · Full GATE CSE 2015 Set 3 paper

GATE 2015 Set 3, Q28 1 mark · MCQ
Report issue

Stacks & Queues

Question 28, GATE 2015: Evaluate the postfix expression whose tokens are: 10 5 + 60 6 / * 8 −. Options: (A) 284; (B) 213; (C) 142; (D) 71.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (10 steps)

1. A stack evaluator pops the right operand first and left operand second. After + the stack contains 15; after / it contains 15,10; after * it contains 150; the final subtraction is 150−8, not 8−150.

2. Postfix evaluation gives 10+5=15, 60/6=10, then 15·10=150, and 150−8=142. Thus C.

Original paper, page 62 · Answer key