The cyclomatic complexity of a flow graph V(G), in terms of predicate nodes, is: [where P is the number of predicate nodes in the flow graph V(G)]
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. P + 1
Explanation
McCabe's cyclomatic complexity can be computed three equivalent ways: V(G) = E – N + 2 (edges, nodes), V(G) = number of enclosed regions of the planar flow graph, and V(G) = P + 1, where P counts the predicate (decision) nodes. Each predicate node adds exactly one binary branch and therefore one more linearly independent path, so starting from a single straight-line path the count grows to P + 1. For example, a program with three simple if-statements and no other branching has V(G) = 3 + 1 = 4 independent paths, which is also the minimum number of basis-path test cases required.More System Software and Operating System questions
- In software testing, how are error, fault and failure related to each other?
- Verification: (A) refers to the set of activities that ensure that software correctly implements a specific function (B) gives answer to th…
- In which testing strategy are the requirements established during requirements analysis validated against the developed software?
- Arrange the following levels of interrupt protection within the Linux Kernel in order of increasing priority: (A) user mode programs (B) bo…
- Given below are two statements: Statement (I): A thread is a dispatchable unit of work that does not execute sequentially and is not interr…
- Given below are an Assertion (A) and a Reason (R): Assertion (A): I/O protection is ensured by a hardware trap. Reason (R): I/O interrupts…