.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

what is cyclomatic complexity ?

Posted By :Gowthammanju     Posted Date :June 09, 2011    Points :40   Category :C# 
Cyclomatic complexity of a piece of code is the number of different paths available in the execution of the program.

If there is no branching (if-else or switch statement) and looping (while, for & do-while loop), then the statements will execute linearly in the function. Hence cynclomatic complexity = 1;

A Branching breaks the linear flow of execution in two parts increasing the Cyclomatic complexity of the program. Same goes for the looping statements.

Hence the more level of indentation we have in our program the more will be the Cyclomatic complexity.

You can also find related Interview Question to what is cyclomatic complexity ?  below: 

What is cyclomatic complexity and why is it important?

  
Cyclomatic complexity is a computer science metric (measurement) developed by Thomas McCabe used to generally measure the complexity of a program. It directly measures the number of linearly independent paths through a programs source code.
The concept, although not the method, is somewhat similar to that of general text complexity measured by the Flesch-Kincaid Readability Test.
Cyclomatic complexity is computed using a graph that describes the control flow of the program. The nodes of the graph correspond to the commands of a program. A directed edge connects two nodes, if the second command might be executed immediately after the first
command. By definition,
CC = E - N + P
where
CC = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend