InterviewSolution
| 1. |
In a software program, what is cyclomatic complexity? |
|
Answer» The number of linearly independent paths in a code segment is measured in terms of cyclomatic complexity. It's a software STATISTIC that shows how COMPLEX a code is. It is calculated using the program's Control Flow Graph. The nodes in the graph represent the smallest set of commands in a program, and a directed edge CONNECTS the two nodes, indicating whether the second command should be executed immediately after the first. The directed graph inside control flow is the edge connecting two basic blocks of the program MATHEMATICALLY, as control may flow from first to second. CC = E − N + P where, CC: cyclomatic complexity. E: number of edges in the control flow graph N: the number of nodes in the control flow graph P: the number of CONNECTED elements |
|