The following postfix expression with single digit operands is evaluated using…

2025

The following postfix expression with single digit operands is evaluated using a stack:

8 2 3 ^ / 2 3 * + 5 1 * -

Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated, written from top to bottom, are:

  1. A.

    6, 1

  2. B.

    5, 7

  3. C.

    3, 2

  4. D.

    1, 5

Attempted by 88 students.

Show answer & explanation

Correct answer: A

Evaluate the postfix expression from left to right using a stack. Write stacks here as [bottom ... top].

1. Push 8, 2, 3 -> [8, 2, 3]
2. Evaluate ^: 2³ = 8 -> [8, 8]
3. Evaluate /: 8 / 8 = 1 -> [1]
4. Push 2, 3 -> [1, 2, 3]
5. First *: 2 × 3 = 6 -> [1, 6]

After the first * is evaluated, the top element is 6 and the next element below it is 1. Therefore, the top two elements from top to bottom are 6, 1. Hence, Option A is correct.

Explore the full course: Niacl Ao It Specialist