Machine-translated by Google. Questions are authored in English.
Top

Discussion

Given a flow graph with 10 nodes, 13 edges and one connected components, the number of regions and the number of predicate (decision) nodes in the flow graph will be

  • A.4, 5
  • B.5, 4
  • C.3, 1
  • D.13, 8

Answer: B

The flow graph has 5 regions and 4 predicate nodes, which is option B. Cyclomatic complexity gives the number of regions as \(V(G) = E - N + 2P\), with E = 13 edges, N = 10 nodes and P = 1 connected component.

\[ V(G) = 13 - 10 + 2 = 5 \]

The number of predicate (decision) nodes is one fewer than the cyclomatic complexity, \(V(G) - 1 = 4\). The pair 4, 5 reverses the two values, and 3, 1 and 13, 8 do not satisfy either formula.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.