6 votes 6 votes Consider the following pseudo- code while (m<n) if (x>y ) and (a<b) then a=a+1 y=y-1 end if m=m+1 end while What is cyclomatic complexity of the above pseudo -code? 2 3 4 5 IS&Software Engineering isro2014 is&software-engineering cyclomatic-complexity non-gate + – neha singh asked Jun 26, 2016 retagged Nov 13, 2017 by Arjun neha singh 7.8k views answer comment Share Follow See all 17 Comments See all 17 17 Comments reply Show 14 previous comments Kapil commented Jun 24, 2016 reply Follow Share 8 - 6 + 2 = 4 0 votes 0 votes shivanisrivarshini commented Jun 24, 2016 reply Follow Share Thank u i got it 1 votes 1 votes `JEET commented Jan 6, 2020 reply Follow Share @Satbir Any idea about the equivalent C code? 0 votes 0 votes Please log in or register to add a comment.
Best answer 14 votes 14 votes Cyclomatic complexity will be 8 - 6 +2 = 4 Kapil answered Jun 26, 2016 selected Jul 2, 2016 by naga praveen Kapil comment Share Follow See all 18 Comments See all 18 18 Comments reply Show 15 previous comments dr_Jackal commented Dec 26, 2019 i edited by dr_Jackal Dec 26, 2019 reply Follow Share Before seeing this question- answer, I still believe there is only one way to escape the loop (without break condition or OS preemption) i.e the falsity of loop condition check , Can anyone please explain me how this edge (?) is opened here, Since official ans is also 4 , but I am getting 3 with my approach. Thanks in advance !!! 0 votes 0 votes commenter commenter commented Jan 3, 2020 reply Follow Share @dr_Jackal Even I'm getting 3 as answer. This solution is clearly wrong. There won't be any edge between last to nodes. Also last node won't be "end while". "end while" must be in last second node. Here they gave just "if'-then" statement not "if-then-else" statement. So in the diagram there is an extra node. 0 votes 0 votes `JEET commented Jan 6, 2020 reply Follow Share This seems to be a favorite question of ISRO. 1 votes 1 votes Please log in or register to add a comment.
10 votes 10 votes Answer is (B) part. Chhotu answered Apr 15, 2017 Chhotu comment Share Follow See 1 comment See all 1 1 comment reply Rahul Garg commented Oct 5, 2017 reply Follow Share which answer is right ... 3 or 4 ? 0 votes 0 votes Please log in or register to add a comment.
5 votes 5 votes Cyclomatic complexity = no of predicate nodes +1 =3+1 One for while, two for if bcoz of two conditions as if first condition then if second condition then do given. Praveen Saini answered Oct 2, 2015 Praveen Saini comment Share Follow See all 2 Comments See all 2 2 Comments reply Sourabh Kumar commented Jun 16, 2016 reply Follow Share Can you draw the control flow graph. 0 votes 0 votes Praveen Saini commented Jun 16, 2016 reply Follow Share \ check that 1 votes 1 votes Please log in or register to add a comment.