Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Data Structures
  • Stacks and queues
  • Easy

What is the value of the postfix expression 6 2 3 + ∗ 4 −6\ 2\ 3\ +\ *\ 4\ - ?

Linear Structures

Pick an option to check your answer.

Evaluate with a stack (push operands, pop two on each operator):

  1. Push 6,2,36, 2, 3.
  2. ++: pop 3,23, 2 → push 2+3=52 + 3 = 5. Stack: 6,56, 5
  3. ∗*: pop 5,65, 6 → push 6×5=306 \times 5 = 30. Stack: 3030
  4. Push 44; −-: pop 4,304, 30 → push 30−4=2630 - 4 = 26.

The infix form is 6×(2+3)−46 \times (2 + 3) - 4.

Why not the others

  • 3030 stops before the final −-, ignoring the 44.
  • −26-26 pops the operands of −- in the wrong order (4−304 - 30); the first popped value is the right operand.
  • 77 treats ∗* as ++: (6+5)−4(6 + 5) - 4.

Report an error

GATE CS · Data Structures · Linear Structures