Compiler Design Control Flow Graph (CFG)


#1

In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
A. In both AST and CFG, let node be the successor of node . In the input program, the code corresponding to is
present after the code cprresponding to
B. For any input program, neither AST nor CFG will contain a cycle
C. The maximum number of successors of a node in an AST and a CFG depends on the input program
D. Each node in AST and CFG corresponds to at most one statement in the input program

Option a is false. Can someone provide an example on that please .


#2

option A is false, as In CFG (Control Flow Graph), code of N2
may be present before N1 when there is a loop or goto.

option B is false, CFG (Control Flow Graph) contains cycle
when input program has loop.

option C is true, successors in AST and CFG depedend on
input program

option D is false, a single statement may belong to a block
of statements.