All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2018

Consider the postfix expression with single-digit operands: 6 2 3 * / 4 2 * + 6 8 * −. The top two elements of the stack after the second * is evaluated are

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. 8,1

Explanation

6 2 3 → * gives 6 (stack 6, 6) → / gives 1 → push 4, 2 → * gives 8. The stack is 1, 8, so the top two are 8, 1.

More Data Structures and Algorithms questions