Data Structures & AlgorithmsModerateWipro · Accenture pattern

What is the value of the postfix expression 6 2 3 + − 3 8 2 / + * ?

  1. A. -7
  2. B. 49
  3. C. 7
  4. D. 1

Correct answer: C. 7

2 3 + = 5; 6 − 5 = 1; 8 2 / = 4; 3 + 4 = 7; finally 1 × 7 = 7. Popping the operands in the wrong order gives 5 − 6 = −1 and hence −7.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic