GATE CS 2026, set 1 · Question 42 · Compiler Design · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

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 B4 and B5?
Note: All the variables are integers.

Control flow graph with five basic blocks. An arrow labelled ENTRY points into block B1. B1 contains: a = b + i. B1 has two outgoing edges: to B2 (left) and to B3 (right). B2 contains three statements in order: a = g * k; f = d - f; a = c * 4. B3 contains two statements in order: t = g * k; b = c + m. Both B2 and B3 have an edge to B4. B4 contains: x = g * k; y = b + i. B4 has an edge to B5. B5 contains: z = c + m. B5 has an outgoing arrow labelled EXIT.
  1. (A) B4: { b + i }
    B5: { c + m }
  2. (B) B4: { g * k }
    B5: { c + m }
  3. (C) B4: { g * k, b + i }
    B5: { }
  4. (D) B4: { g * k }
    B5: { }
Answer

Answer (D)

Answer from the official GATE CS 2026 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes