A flow graph 𝐹 with entry node (1) and exit node (11) is shown below: How…

2019

A flow graph 𝐹 with entry node (1) and exit node (11) is shown below:

How many predicate nodes are there and what are their names?

  1. A.

    Three: (1,(2,3),6)

  2. B.

    Three: (1,4,6)

  3. C.

    Four: ((2,3),6,10,11)

  4. D.

    Four: ((2,3), 6,9,10)

Attempted by 79 students.

Show answer & explanation

Correct answer: A

Answer: There are three predicate (decision) nodes: 1, the node labeled 2,3, and 6.

Definition: A predicate (decision) node is any node where control can split to two or more different successors.

  • Node 1: Node 1 acts as a decision/entry point in the flow (it is part of the loop/entry control), so it serves as a predicate.

  • Node labeled "2,3": This node clearly branches to the left into node 6 and to the right into nodes 4/5, so it has multiple successors and is a predicate.

  • Node 6: Node 6 branches to nodes 7 and 8 (two different successor paths), making it a predicate node.

Note: Nodes such as 4, 5, 7, 8, 9, 10, and 11 are not predicate nodes because they do not split control (they have a single successor or are terminal).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor