Which of the following infix expressions is obtained on converting the postfix…

2018

Which of the following infix expressions is obtained on converting the postfix expression

A B - C + D E F - + $

  1. A.

    A - B + C + D $ E - F

  2. B.

    A - B + C $ D + E - F

  3. C.

    A - B $ C + D + E - F

  4. D.

    A + B - C $ D + E - F

Attempted by 96 students.

Show answer & explanation

Correct answer: B

The correct option is B. We evaluate the postfix expression A B - C + D E F - + $ step-by-step using a stack. Operands are pushed onto the stack, and operators combine them:

  1. A B - becomes (A - B)

  2. (A - B) C + becomes (A - B + C)

  3. D E F - + becomes (D + (E - F))

  4. Finally, $ combines them into (A - B + C) $ (D + E - F), which matches Option B without unnecessary parentheses.

Explore the full course: Btsc Lab Assistant