GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Placement Papers  >  Hughes  >  Technical
Go To First  |  Previous Question  |  Next Question 
 Technical  |  Question 31 of 41    Print  
Cyclomatic complexity
{if((x=0) or (y=0))
p=0;
else
{p=x;i=1;
while(i!=y)
{p=p+x;
i=i+1;}
}
}

  
Total Answers and Comments: 3 Last Update: December 07, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 15, 2005 01:40:40   #1  
Amit Dhamija        

RE: Cyclomatic complexity{if((x=0) or (y=0))p=0;else{p=x;i=1;while(i!=y){p=p+x;i=i+1;}}}
ans. 2
 
Is this answer useful? Yes | No
November 09, 2006 06:27:49   #2  
chaitanya        

RE: Cyclomatic complexity{if((x=0) or (y=0))...

How the answer is 2. Since there are 3 independent paths if u c if am not wrong.


 
Is this answer useful? Yes | No
December 06, 2006 17:04:40   #3  
abhi_dendrite        

RE: Cyclomatic complexity{if((x=0) or (y=0))...

The program begins with a conditional statement if (x==0) ||( y==0)...therefore it gives rise to 2 paths

Lets take a dry run...

lets say a) x=1,y=0; b) x=0 & y=0; c) x=0,y=1; d) x=1,y=1

condition a returns true

condition b returns true

condition c returns true

condition d returns false

Therefore there are actually 2 possibilities hence 2 paths two individual paths for the code..There cannot be any other possibility..

Also if we do a flowchart E=2; N=2 and cyclomatic complexity E-N+2=2

If I am wrong please enlighten me abhi_dendrite


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 
Related Categories




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape