Question
Official answer and solution
- Official answer
- D
- From
- Official GATE 2026 answer key
Solution
Perform available-expressions analysis along all paths from ENTRY to B4 and B5.
An expression is redundant (a common subexpression) at a point if and only if it is available on every path from ENTRY to that point without any of its operands being redefined afterwards:
- In block B4 (
x = g * k,y = b + i):g * k: Computed inB2(a = g * k) and inB3(t = g * k), and neithergnorkis modified later inB2orB3. Since every path fromENTRYtoB4passes through eitherB2orB3,g * kis available atB4and is therefore redundant.b + i: Computed inB1, but along the pathB1 -> B3 -> B4, blockB3redefinesb(b = c + m), killingb + i. Henceb + iis not available atB4.
- In block B5 (
z = c + m):c + m: Computed inB3, but never computed along the pathB1 -> B2 -> B4 -> B5. Hencec + mis not available atB5.
Therefore, the redundant expressions are B4: { g * k } and B5: { }.
Option (D)
Treating c + m or b + i as available when they are only available along one of the two branches.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2026 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 42 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.