Convert the following arithmetic expression into postfix form: A - B - D * E /…

2018

Convert the following arithmetic expression into postfix form:

A - B - D * E / F + B * C

Answer: D. AB-DE*F / -BC*+CONCEPTIn infix-to-postfix conversion, operands are emitted immediately, while operators wait on a stack. An incoming left-associative operator first pops…

  1. A.

    AB-DE / F*-BC*+

  2. B.

    AB-DE* / F-BC*+

  3. C.

    AB-DE*F / -BC+*

  4. D.

    AB-DE*F / -BC*+

Attempted by 631 students.

Show answer & explanation

Correct answer: D

CONCEPT

In infix-to-postfix conversion, operands are emitted immediately, while operators wait on a stack. An incoming left-associative operator first pops operators of higher or equal precedence; multiplication and division outrank addition and subtraction.

APPLICATION

  1. Emit A and B. When the second subtraction sign arrives, pop the earlier subtraction because both have equal precedence and are left-associative. The output becomes A B -.

  2. Emit D and E, then pop multiplication before division. This creates D E *; after emitting F, division creates D E * F /.

  3. When addition arrives, pop the pending division and subtraction. The accumulated output is A B - D E * F / -; then push addition.

  4. Emit B and C, pop multiplication, and finally pop addition. The completed postfix sequence is A B - D E * F / - B C * +.

CROSS-CHECK

Reading the postfix result back builds (A - B), then (D * E) / F, subtracts the second from the first, and finally adds B * C. This reconstructs A - B - D * E / F + B * C under the standard left-to-right associativity rules.

RESULT

A B - D E * F / - B C * +

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs

Loading lesson…