Thursday, April 25, 2024

Expression used to compute cyclomatic complexity for a program


 Answer: A

Cyclomatic Complexity

-       is a software metric that measures the logical complexity of the program code.

-       It counts the number of decisions in the given program code.

-       It measures the number of linearly independent paths through the program code.

Mathematically, it is set of independent paths through the graph diagram.

The Code complexity of the program can be defined using the formula –

M = E – N + 2P 

where,

 E = the number of edges in the control flow graph 
N = the number of nodes in the control flow graph 
P = the number of connected components 

In a case, where exit point is directly connected back to the entry point, then

M = E – N + P

In the case of a single method, P is equal to 1. So, for a single subroutine, the formula can be defined as

M = E – N + 2


0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top