**CYCLOMATIC COMPLEXITY – SOLVED PROBLEMS**

**Cyclomatic complexity is a software metric. It provides a quantitative measure of the logical complexity of a program.Cyclomatic complexity provides us with an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once.**

**Cyclomatic complexity has a foundation in graph theory and is computed in one of three ways.**

** 1. The number of regions correspond to the cyclomatic complexity.**

** 2. Cyclomatic complexity V(G) for a flow graph G, is defined as,
V(G)=E-N+2**

**where E=Number of flow graph edges**

**N=Number of flow graph nodes**

**3.Cyclomatic complexity,V(G) for a flow graph G, is defined as,**

V(G)=P+1

where P=Number of predicate nodes contained in flow graph G.

V(G)=P+1

where P=Number of predicate nodes contained in flow graph G.

**DECEMBER 2013 – PAPER III Q.NO 4**

**4. Given a flow graph with 10 nodes, 13 edges and one connected components, the number of regions and the number of predicate(decision) nodes in the flow graph will be**

**A)4,5**

**B)5,4**

**C)3,1**

**D)13,8**

**Ans:-B**

**Explanation:-**

**N=10,E=13**

**V(G)=E-N+2**

**V(G)=13-10+2**

**=3+2=5**

**Therefore, No of regions = 5. (According to rule 1.)**

**According to rule 3, V(G)=P+1**

**V(G) refers to the cyclomatic complexity which is equal to the no of regions.**

**5=P+1**

**P=5-1=4**

**So, the number of predicate nodes in the flow graph is 4.**

**So, the number of regions and the number of predicate nodes in the flow graph will be 5,4**

**Therefore, the correct answer is B.**

**JUNE 2013 – PAPER II Q.No 5**

** 5. Cyclomatic complexity of a flow graph G with n vertices and e edges is**

** A)V(G)=e+n-2**

** B)V(G)=e-n+2**

** C)V(G)=e+n+2**

** D)V(G)=e-n-2**

** Ans:-B**

** Explanation:-**

** According to rule 2, the formula for Cyclomatic Complexity V(G)=e-n+2 where e is no of edges, n is no of vertices.**

**JUNE 2012 – PAPER III Q.No 33**

** 33. Which one of the following statements is incorrect ?**

** (A) The number of regions corresponds to the cyclomatic complexity.**

** (B) Cyclometric complexity for a flow graph G is V(G) = N – E + 2, where E is the number of edges and N is the number of nodes in the flow graph.**

** (C) Cyclometric complexity for a flow graph G is V(G) = E – N + 2, where E is the number of edges & N is the number of nodes in the flow graph.**

** (D) Cyclometric complexity for a flow graph G is V(G) = P + 1, where P is the number of predicate nodes contained in the flow graph G.**

** Ans:- B**

** Explanation:-**

** According to the formulas given in (1),(2) and (3), option B is incorrect, because V(G)=E-N+2 and not N-E+2.**

**DECEMBER 2011 – PAPER II Q.No 15**

** 15. McCabe’s cyclomatic metric V(G) of a graph with n vertices, e edges and p connected component is**

** A)e**

** B)n**

** C)e-n+p**

** D)e-n+2p**

** Ans:-C**

** Explanation:-**

** According to McCabe’s cyclomatic metric of a graph V(G)=E-N+P where P refers to connected components.**

**JUNE 2006 – PAPER II Q.No 42**

** 42. In Software Metrics, McCABE��’s cyclomatic number is given by following formula :**

** (A) c=e-n+2p**

** (B) c=e-n-2p**

** (C) c=e+n+2p**

** (D) c=e-n*2p**

** Ans:-A**

** I hope all of you can solve problems based on cyclomatic complexity of a graph, with confidence and ease, after going through the above article.REFER TO MY OTHER POSTS ON SOFTWARE ENGINEERING**

**JUNE 2014 – PAPER III**

**17. Assume that a program will experience 200 failures in infinite time. It has now experienced 100 failures. The initial failure intensity was 20 failures/CPU hr. Then the current failure intensity will be**

** (A) 5 failures/CPU hr**

** (B) 10 failures/CPU hr.**

** (C) 20 failures/CPU hr**

** (D) 40 failures /CPU hr**

**Ans:- B**

** Explanation:- The formula for Current Failure Intensity =**

** Initial Failure intensity X [ 1 – Experienced failures/Failures in infinite time ]**

** = 20 X [ 1 – 100/200 ]**

** =20 X (100/200)**

** =10 failures /CPU hr**

**18. Consider a project with the following functional units :**

** Number of user inputs = 50**

** Number of user outputs = 40**

** Number of user enquiries = 35**

** Number of user files = 06**

** Number of external interfaces = 04**

** Assuming all complexity adjustment factors and weighing factors as average, the function points for the project will be**

** (A)135**

** (B)722**

** (C)675**

** (D)672**

**Ans:- **

** Explanation:-**

Measurement parameter |
Count |
Weighting Factor(Average) |
Total |
---|---|---|---|

Number of user inputs |
50 |
4 |
=200 |

Number of user outputs |
40 |
5 |
=200 |

Number of user enquiries |
35 |
4 |
=140 |

Number of user files |
6 |
10 |
=60 |

Number of external interfaces |
4 |
7 |
=28 |

**Functon point (FP) = count total X (0.65 + 0.01 X S(fi))**

** = 628 X (0.65 + .01 X 30)**

** = 596.6**

** There is no option like that given. So I am not choosing anything.**

**The weighting factors of Simple project are 3,4,3,7,5**

**The weighting factors of Complex project are 6,7,6,15,10**

*Formula for Function point (FP for Simple project)= count total X (0.65+0.01 X 22)*

*Formula for Function point (FP for Complex project)= count total X (0.65+0.01 X 44)*

__TRY OUT THE FOLLOWING PROBLEMS__

**1. Compute the function point value for a project with the following information domain characteristics**

** Number of user inputs : 23**

** Number of user output : 60**

** Number of user enquiries : 24**

** Number of files : 10**

** Number of external interface : 05**

** Assume that all complexity adjustment values are average.**

** Ans : – 591.85**

**2. Compute the function point value for a project with the following information domain characteristics.**

** Number of user inputs : 28**

** Number of user outputs : 50**

** Number of user enquiries : 42**

** Number of files : 07**

** Number of external interface : 03**

** Assume that all complexity adjustment values are simple.**

** Ans:- 412.38**

**CAPABILITY MATURITY MODEL**

**CMM stands for Capability Maturity Model. This was developed by Software Engineering Institute(SEI). This is a well known benchmark for judging the quality level of the processes in the organization. CMM defines five levels determined on the basis of organisation’s support for certain “key” process areas known as KPAs. The five levels are:**

CMM – LEVEL 1 |
Initial |
Undefined, chaotic, no process in place |

CMM – LEVEL 2 |
Repeatable |
Basic project management processes are in place. |

CMM – LEVEL 3 |
Defined |
In addition to level 2 activities, organization has defined processes and management activities are documented. |

CMM – LEVEL 4 |
Managed |
Standards are built for organization. Managed through setting standards |

CMM – LEVEL 5 |
Optimising |
Leveraging on knowledge and innovative ideas. Continous process improvement and preventing the occurrence of defects. |

**JUNE 2014 – PAPER II**

** 11. KPA in CMM stands for**

** A) Key Process Area**

** B) Key Product Area**

** C) Key Principal Area**

** D) Key Performance Area**

** Ans:- A**

**JUNE 2014 – PAPER III**

** 21. Which one of the following is not a key process area in CMM level 5 ?**

** (A) Defect prevention**

** (B) Process change management**

** (C) Software product engineering**

** (D) Technology change management**

** Ans:- C**

**DECEMBER 2012 – PAPER II**

** 19. The maturity levels used to measure a process are**

** (A) Initial, Repeatable, Defined, Managed, Optimized.**

** (B) Primary, Secondary, Defined,Managed, Optimized.**

** (C) Initial, Stating, Defined, Managed, Optimized.**

** (D) None of the above**

** Ans:- A**

**JUNE 2012 – PAPER II**

** 21. Key process areas of CMM level 4 are also classified by a process which is**

** (A) CMM level 2**

** (B) CMM level 3**

** (C) CMM level 5**

** (D) All of the above**

** Ans:- B**

**JUNE 2009 – PAPER II**

** 39. Capability Maturity Model is meant for:**

** A) Product**

** B) Process**

** C) Product and process**

** D) None of the above**

** Ans:- B**

**DECEMBER 2008 – PAPER II**

** 44. Which level is called as “defined” in capability maturity model?**

** A) level 0**

** B) level 3**

** C) level 4**

** D) level 1**

** Ans:- B**

**JUNE 2005 – PAPER II**

**41. The capability maturity model defines 5 levels :**

** a) level 1 i) Managed**

** b) level 2 ii) Defined**

** c) Level 3 iii) Repeatable**

** d) Level 4 iv) Initial**

** e) Level 5 v) Optimised**

** Correct matching is:**

** (a) (b) (c) (d) (e)**

** A) i ii iii iv v**

** B) iv iii ii i v**

** C) v i iii ii iv**

** D) v ii i iii iv**

** Ans:- B**