In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 2 · Q14
Time
Select one answerSingle correct
Solution
Official answer: See verified solution
Intermediate Code GenerationLet us analyze the given statements regarding AST and CFG:
Option A is False: In a CFG, backward edges (such as in loops or backwards goto jumps) can lead from a node to a successor whose corresponding code appears earlier in the program text.
Option B is False: A CFG will contain cycles whenever the input program contains loops or recursive flow constructs.
Option C: The number of successors of a node in an AST depends on the construct (for instance, an -ary operator or a statement list) and in a CFG depends on branching constructs (such as a multi-way switch statement), which vary with the input program. However, under certain restricted standard definitions of AST/CFG, this phrasing was deemed ambiguous, and this question was marked as Marks to All (MTA) in the official GATE key.
Option D is False: A basic block in a CFG typically comprises a sequence of multiple consecutive three-address code statements, not at most one.
Try the question first, then check your work.
Examiner trap
Consider the structure of loops in a Control Flow Graph (CFG) and what kinds of multi-branch constructs or basic blocks can appear in ASTs and CFGs.
This Intermediate Code Generation previous year question is Q14 of the GATE CSE 2015 Set 2 paper. Find more GATE CSE PYQs on Intermediate Code Generation in Compiler Design, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Intermediate Code Generation PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Intermediate Code Generation has 14 GATE CSE PYQs across 12 papers from 2011 to 2025. 5 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 2.
How GATE tests Intermediate Code GenerationIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.