Which of the following expressions is represented by the parse tree?
2010
Which of the following expressions is represented by the parse tree?

Answer: A. (A + B) * C — Concept: In a parse (expression) tree every interior node is an operator and its children are that operator’s operands. The operator sitting at the root is…
- A.
(A + B) * C
- B.
A + * BC
- C.
A + B * C
- D.
A * C + B
Attempted by 112 students.
Show answer & explanation
Correct answer: A
Concept: In a parse (expression) tree every interior node is an operator and its children are that operator’s operands. The operator sitting at the root is applied last, and operators lower down the tree are applied first. To read such a tree back as an infix expression, write the left subtree, then the operator, then the right subtree — placing brackets around a subtree whenever its operator binds more loosely than its parent’s.
Application: The tree shown has (*) at the root. Its left child is the operator (+), whose two children are the leaves A and B; its right child is the leaf C. Rebuild the expression from the leaves upward:
The (+) node joins the leaves A and B, so that subtree stands for the sum A + B.
That subtree is one operand of the root (*), and the leaf C is its other operand, so the root stands for the sum A + B multiplied by C.
Because the + node sits directly beneath the * node, the sum has to be bracketed when it is written inline: without brackets the standard precedence rules would attach the multiplication to B alone and give a different tree. The expression therefore reads (A + B) * C.
Cross-check: Convert each of the remaining expressions back into a tree and compare the shapes:
A + B * C would put + at the root with a B * C subtree hanging below it — the reverse of the nesting drawn here, where the + is the child of the *.
A * C + B would also put + at the root, and it pairs A with C under the multiplication, whereas the tree drawn here pairs A with B under the addition.
A + * BC places the two operators side by side with no operand between them, so it is not a well-formed infix expression and no operator/operand tree matches it.
Result: The parse tree represents (A + B) * C.
Explore the full course: Mppsc Assistant Professor Computer Science Paper 2