Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q32 — Parsing (LL, LR)

Explain with AI

Consider the control flow graph shown in the figure.


Which one of the following options correctly lists the set of redundant expressions (common subexpressions) in the basic blocks B44 and B55?

Note: All the variables are integers.

Choose one option
View worked solution

Answer: D

An expression EE is a redundant (common) subexpression at a basic block if it is guaranteed to be previously computed along all paths leading to that block, and none of its operand variables have been modified since their last computation (i.e., the expression is available).

Analyzing the control flow graph:

  • At Basic Block B4: The expression g∗kg * k is computed in B1B_1 and its operands gg and kk are not modified along any path leading to B4B_4. Thus, g∗kg * k is redundant. However, b+ib + i is not redundant because bb is modified in block B2B_2 along the path B1→B2→B4B_1 \rightarrow B_2 \rightarrow B_4, killing the expression.
  • At Basic Block B5: The expression c+mc + m is not redundant because cc is modified in block B3B_3 along the path B1→B3→B5B_1 \rightarrow B_3 \rightarrow B_5, killing the expression. Thus, the set of redundant expressions at B5B_5 is empty, i.e., {}\{\}.

Therefore, the correct option is D.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Parsing (LL, LR) questions