GeekInterview.com
Series: Subject: Topic:
Question: 36 of 47

Given the following code, which is true about the minimum number of test cases

required for full statement and branch coverage

Read P

Read Q

IF P+Q > 100 THEN

Print "Large"

ENDIF

IF P > 50 THEN

Print "P Large"

ENDIF

a) 1 test for statement coverage, 3 for branch coverage

b) 1 test for statement coverage, 2 for branch coverage

c) 1 test for statement coverage, 1 for branch coverage

d) 2 tests for statement coverage, 3 for branch coverage

e) 2 tests for statement coverage, 2 for branch coverage



Asked by: durga_geek | Member Since Jan-2007 | Asked on: Jan 3rd, 2007

View all questions by durga_geek

Showing Answers 1 - 7 of 7 Answers
sumit

Answered On : Jan 23rd, 2007

option -b

  
Login to rate this answer.
Sujatars

Answered On : Feb 27th, 2007

View all answers by Sujatars

I think its  option d

  
Login to rate this answer.
ksaisridhar2k

Answered On : Feb 28th, 2007

View all answers by ksaisridhar2k

Answer is B since we need minimum number of test cases..


For Branch Coverage: As we have two If statements, we need 2 test cases.

One to test If P+Q>100 and another for If P>50.

  
Login to rate this answer.
tara

Answered On : Aug 9th, 2007

hi,
i have just read the question.
some of our friends saying that we require only one testcase for statement coverage.
this is ok for positive testing.for the negative testing we need one more test case.
example:if they are numbers it is ok.but when we give other other than numbers it must give some error message.
    and also i think for black box testing we need 2 test cases for statement coverage for this example/code.as this is white box testing do we need only one statement coverage.
my answer is option e
if my answer is wrong please let me know.
Tara.

  
Login to rate this answer.
qamem84

Answered On : Feb 20th, 2008

View all answers by qamem84

ans is B... n tis is a ISTQB question... :) am i rite ?

Yes  1 User has rated as useful.
  
Login to rate this answer.
helloworld08

Answered On : Sep 13th, 2008

View all answers by helloworld08

option - b) is the correct answer.

1) if p = 51, Q= 50 it will cover all the statements. so, one test for statement coverage.

2) for branch coverage:

a)  P+Q> 100 AND P>50 (True)
b)  P+Q < 100 AND P<50 (False)

a) & b) will cover both the branch conditions
yes, it is an ISTQB question.

Yes  1 User has rated as useful.
  
Login to rate this answer.

Answer: B) 1 test for statement coverage, 2 for branch coverage

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.