Question
Download Solution PDFThe Cyclomatic complexity of two modules A and B are 10 and 15 respectively :
What is the cyclomatic complexity of sequential integration of A and B ?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is Option 1: 19.
Key Points
- Cyclomatic complexity is a software metric used to measure the complexity of a program.
- It is calculated by using the control flow graph of the program, where nodes represent processing tasks and edges represent control flow between the nodes.
- The formula to calculate cyclomatic complexity is:
M = E - N + 2P
whereM
is the cyclomatic complexity,E
is the number of edges,N
is the number of nodes, andP
is the number of connected components (usually 1 for a single program). - When integrating two modules sequentially, the cyclomatic complexity of the combined module is the sum of the individual complexities.
- For modules A and B with cyclomatic complexities 10 and 15 respectively, the combined complexity is:
10 + 15 - 1*2 + 2 = 19
Subtracting the duplicate edge (1) and adding 2 for the single connected component.
Additional Information
- Cyclomatic complexity is used to gauge the complexity of a program and to identify areas that may require more thorough testing or refactoring.
- Higher cyclomatic complexity indicates a more complex program, which might be harder to understand, maintain, and test.
- Tools like McCabe IQ, SonarQube, and others can automatically calculate cyclomatic complexity for various programming languages.
- Reducing cyclomatic complexity can lead to more maintainable and reliable code.
Last updated on Feb 20, 2025
-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.
-> Online application form, last date has been extended up to from 17th April 2025.
->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.
-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).