edited by
13,148 views
44 votes
44 votes

In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
 

  1. In both AST and CFG, let node $N_2$ be the successor of node $N_1$. In the input program, the code corresponding to $N_2$ is present after the code corresponding to $N_1$
  2. For any input program, neither AST nor CFG will contain a cycle
  3. The maximum number of successors of a node  in an AST and a CFG depends on the input program
  4. Each node in AST and CFG corresponds to at most one statement in the input program
edited by

1 Answer

Best answer
70 votes
70 votes

Option (C) is Correct

  1. is false , In CFG , code of $N_2$ may be present before $N_1$ when there is a loop or Goto.
  2. is false , CFG contains cycle when input program has loop.
  3. is true ,successors in AST and CFG depend on Input program. 
  4. is false, In CFG a single node may belong to a block of statements.
edited by
Answer:

Related questions

26 votes
26 votes
5 answers
3
go_editor asked Feb 12, 2015
14,388 views
Consider the following routing table at an IP router:$$\begin{array}{|l|l|l|} \hline \textbf {Network No} & \textbf {Net Mask} & \textbf{Next Hop} \\\hline \text {128.96...