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
- A.
AB-DE / F*-BC*+
- B.
AB-DE* / F-BC*+
- C.
AB-DE*F / -BC+*
- D.
AB-DE*F / -BC*+
Attempted by 258 students.
Show answer & explanation
Correct answer: D
To convert the infix expression A - B - D * E / F + B * C to postfix, we follow operator precedence and associativity rules. Multiplication (*) and division (/) have higher precedence than addition (+) and subtraction (-). Left-to-right associativity applies to operators of equal precedence.\nFirst, evaluate D * E as DE*, then divide by F giving DE*/. Next, compute A - B as AB-. Now the expression becomes (AB-) - (DE*/) + BC*. Since subtraction and addition are left-associative, we subtract the second term from the first: AB-DE*/-. Finally, add BC* to get AB-DE*/BC*+.\nOption D matches this sequence exactly. Option A incorrectly places division before multiplication, violating left-to-right associativity for equal precedence operators. Option B misplaces the subtraction operator relative to the division result, altering the evaluation order.