GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Testing  >  Common
Go To First  |  Previous Question  |  Next Question 
 Common  |  Question 210 of 248    Print  
Statement and Branch Coverage
Hi All,

Pls let me know the statement coverage and branch coverage for the below code.

Read P
Read Q
IF P+Q > 100 THEN
Print “Large”
ENDIF
If P > 50 THEN
Print “P Large”
ENDIF


Regards,
Vidhya



  
Total Answers and Comments: 5 Last Update: December 25, 2008     Asked by: vidhya.sadasivam 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: jitendramishra
 
Hi All,
In the above mentioned script Statement  Coverage means all the statement has been covered or not and Branch Coverage means all the Conditions has been covered or not.

So for statement coverage we need to test the statement
-Print “Large”n
-
Print “P Large”
has been executed or not.

For Branch coverage(Condition coverage) we have to check the condition by passing some value and cheking all the conditions (true/false) are executed or not
-      P+Q > 100
-      P > 50


Please make me understand if i am wrong.

Thanks, Jitu


Above answer was rated as good by the following members:
rajnit
February 04, 2008 06:10:28   #1  
kumsan060 Member Since: December 2007   Contribution: 45    

RE: Statement and Branch Coverage
Statement is P+q Is itself statment Coverage because its adding (Operation performing) two Variable
Branch Coverages are two here greater than 100 Large and Less than that print Small

 
Is this answer useful? Yes | No
April 15, 2008 13:23:57   #2  
G.D.S.Prasad Member Since: November 2006   Contribution: 191    

RE: Statement and Branch Coverage
1 test case for statement coverage 2 test cases for branch coverage.
 
Is this answer useful? Yes | No
June 24, 2008 10:44:23   #3  
jitendramishra Member Since: August 2006   Contribution: 10    

RE: Statement and Branch Coverage
Hi All
In the above mentioned script Statement Coverage means all the statement has been covered or not and Branch Coverage means all the Conditions has been covered or not.

So for statement coverage we need to test the statement
-Print “Large”n
-
Print “P Large”
has been executed or not.

For Branch coverage(Condition coverage) we have to check the condition by passing some value and cheking all the conditions (true/false) are executed or not
- P+Q > 100
- P > 50


Please make me understand if i am wrong.

Thanks Jitu

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 03, 2008 00:48:17   #4  
krishna0518 Member Since: September 2008   Contribution: 3    

RE: Statement and Branch Coverage
Coverage is nothing but degree expressed as a percentage to which a specific coverage item has been exercised by a set of tests.

Branch is nothing but conditional transfer of a control from any other statement to other statement.
Here the condition is transftered from the first statement to second statement.

 
Is this answer useful? Yes | No
December 25, 2008 07:32:40   #5  
sibithomas1811 Member Since: December 2008   Contribution: 1    

RE: Statement and Branch Coverage
Statement Coverage:

Percentage of statements covered in a code is known as statement coverage.

Branch Coverage:
Percentage of branches covered in a code

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape