CS FundamentalsHardGATE CS · product placement
McCabe's V(G) = E - N + 2 for one function comes from the cyclomatic number of a strongly connected graph, E - N + P. Where does the '+2' come from?
- A. One for the entry node and one for the exit node
- B. A virtual edge is added from the exit back to the entry to make the graph strongly connected, so (E + 1) - N + 1
- C. It is an empirical correction for unstructured code such as goto
- D. It counts the true and false outcomes of the first decision
Correct answer: B. A virtual edge is added from the exit back to the entry to make the graph strongly connected, so (E + 1) - N + 1
Adding one back edge makes the graph strongly connected with E + 1 edges and P = 1 component, giving (E + 1) - N + 1 = E - N + 2. For P separate functions the formula becomes E - N + 2P.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A loan is approved if (salary ≥ ₹50,000 AND credit history is good) OR a guarantor is provided. Using a limited-entry decision table with…
- An ATM state machine: inserting a card leads to '1st try'. A correct PIN in any try state leads to 'Access'; a wrong PIN moves 1st → 2nd →…
- A price field accepts amounts from ₹0.01 to ₹999.99, with exactly two decimal places. Which pair of values are the invalid boundary values…
- For the function below, what are its cyclomatic complexity and the number of times a[j] > a[j + 1] is evaluated for the input [2, 1, 3, 4…
- Assertion (A): A suite with 100% branch coverage can still miss a defect where a required check was never coded. Reason (R): White-box…
- How many of these are static testing activities: (1) a peer code review, (2) running a linter such as ESLint, (3) executing unit tests…