what is cyclomatic complexity? plz explain with example

Answers were Sorted based on User's Feedback



what is cyclomatic complexity? plz explain with example..

Answer / srinivas

Cyclomatic Complexity is a White Box Testing Type.

Is This Answer Correct ?    232 Yes 45 No

what is cyclomatic complexity? plz explain with example..

Answer / dhakshna

The easiest way is to sum the number of binary decision
statements (e.g. if, while, for, etc.) and add 1 to
it

Below is a simple program as an
example:
IF A = 354
THEN IF B > C
THEN A = B
ELSE A = C
ENDIF
ENDIF
Print A

one may calculate the cyclomatic complexity using the
decision points rule. Since there are two decision points,
the cyclomatic complexity is 2 + 1 = 3.

Is This Answer Correct ?    109 Yes 14 No

what is cyclomatic complexity? plz explain with example..

Answer / sujatha

Hai,
It's used to measure the complexcity of the software
process.
It's used to measure the how many no.of test cases are used
to test the app in all posible ways.

Is This Answer Correct ?    107 Yes 29 No

what is cyclomatic complexity? plz explain with example..

Answer / amit

Cyclomatic Complaxity comes under white box testing.
It means best path searching. To measure logical Complaxity
of a prog.
for ex.

1-main()
2-if(a>1)
3{
------
------
}
4-else
5-{
-------
-------
}
}

Now a diagram would drawn from top as it would start from 1.
underneath it would be 2. and 2 would have two edges i.e. 3
and 4. they would futher combine to form 5.

2,3,4 & 5 would make close regeoin while outside would
become open region..

the arrows joining would be edges 2 would become predicate
node. while others are simple nodes.

it has got a formula:

v(g)=Node-edges+2
v(g)= 5-5+2
v(g)=2
v(g)= predicate node+1
v(g)=1+1
v(g)=2

So its logical correct.

Please correct me if i'm wrong.

Is This Answer Correct ?    74 Yes 29 No

what is cyclomatic complexity? plz explain with example..

Answer / mrinalini

Cyclomatic complexity is a metric used for complexity based
testing proposed by McCabe
McCabe actually proposed 3 metrics:cyclomatic,essential and
actual complexity.All 3 are based on the graphical
representation of the program being tested.First 2 are
calculated from the graph and the 3rd one is runtime metric.
mcCabe used the theory of graph in defining Cylocamatic
complexityThere are sets of
linearly independent program paths through any program
graph. A maximum set of these linearly
independent paths, called a basis set, can always be found.
Intuitively, since the program graph
and any path through the graph can be constructed from the
basis set, the size of this basis set should be related to
program complexity. hence in a layman's language Cyclomatic
complexity is number of Decision statements in the program
being tested plus one.

Is This Answer Correct ?    41 Yes 9 No

what is cyclomatic complexity? plz explain with example..

Answer / hnv bhaskar

Cyclomatic complexity is a white box testing technique, used
for Structural Testing.
CC can be calculated with two types of formulae:
a) M=E-N+2P
b) M=E-N+P (For Strongly connected systems, i.e, Exit point
is connected back to Starting Point.

E= No. of Edges.
N= No. of Nodes.
P= No. of Connected components.

Is This Answer Correct ?    6 Yes 1 No

what is cyclomatic complexity? plz explain with example..

Answer / devyani

Below is a simple program as an example:
IF A = 354
THEN IF B > C
THEN A = B
ELSEA= C
ENDIF
ENDIF
Print A
The control flow generated from the program would look like Figure 3.2.
The control flow shows seven nodes (shapes) and eight edges (lines), thus using the formal formula the cyclomatic complexity is 8-7 + 2 = 3. In this case there is no graph called or subroutine. Alternatively one may calculate the cyclomatic complexity using the decision points rule. Since there are two decision points, the cyclomatic complexity is 2 + 1 = 3.

Is This Answer Correct ?    5 Yes 1 No

what is cyclomatic complexity? plz explain with example..

Answer / dheemanth kumar

Cyclomatic complexity is a software metric (measurement).
It was developed by Thomas McCabe and is used to measure
the complexity of a program. It directly measures the
number of linearly independent paths through a program's
source code.
M = E − N + 2P
where

M = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components.
"M" is alternatively defined to be one larger than the
number of decision points (if/case-statements, while-
statements, etc) in a module (function, procedure, chart
node, etc.), or more generally a system.

Separate subroutines are treated as being independent,
disconnected components of the program's control flow graph.


[edit] Alternative definition
v(G) = e − n + p
G is a program's flowgraph
e is the number of edges (arcs) in the flowgraph
n is the number of nodes in the flowgraph
p is the number of connected components

[edit] Alternative way
There is another simple way to determine the cyclomatic
number. This is done by counting the number of closed loops
in the flow graph, and incrementing the number by one.

i.e.

M = Number of closed loops + 1
where

M = Cyclomatic number.

Is This Answer Correct ?    19 Yes 16 No

what is cyclomatic complexity? plz explain with example..

Answer / keerthana

example
int a,b;
a=10,b=20;
if(a<b)
{
printf("a is greater");
}
else
{
printf("b is greater");
}
draw the flow chart for this program and count number nodes
in the flowchart.
the formula is v(G)=E-N+2P
E is edge
N is number of nodes
p predicated node
for eg
V(G)=E-n+2P
4-4+2=2
the path of the program is 2 we got write answer

Is This Answer Correct ?    6 Yes 3 No

what is cyclomatic complexity? plz explain with example..

Answer / praveen kumar

M = E &#8722; N + 2P
where

M = cyclomatic complexity
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected components

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Manual Testing Interview Questions

give 1 example of an error with high severity and low priority?

4 Answers   Omnitech,


2.what is the differnce bet project volume and v.s.s and what is the advantage of v.s.s?

1 Answers   Tech Mahindra,


anyone ca explain Tracebility metrics.how to involve on this.

2 Answers  


what is the difference between system development life cycle & software development life cyle(sdlc) what is system development life cycle

4 Answers   A3Logics, IBM,


Hi all, i am planning to take ISTQB CERTIFICATION, can any one guide me by giving the links for preparing for the exams. If anyone have some materials can u send me to my mail id vpbharathi@gmail.com. Thanks in advance, Bharathi.P

0 Answers  






How do we create a regression sute in td

0 Answers  


How do tou design a good test case?

4 Answers   Cognizant,


difference between QA, QC

6 Answers  


1.What is bidirectional traceability ??? and how it is implemented? 2.What is Automation Test frame work ? 3. Define the components present in test strategy? 4. Define the components present in test plan? 5. Have u written Test plan ?…. thank u!plz reply........

0 Answers   Covansys,


How will you test language converter e.g. (English to Spanish) without Automation tool? OR What are the test cases or scenarios for language converter? Conditions: 1. without Automation tool, 2. You know only English language. 3. Make sure the tests should produce 80-90% pass result.

2 Answers   Mastek,


Can you explain Co-habiting software?

0 Answers  


What is Equivalence partitioning,Boundary value analysis,Decision table testing,State transition testing,Use case testing. Plz explain with example and differences if any

3 Answers  


Categories