Hi, Below is a question on white box testing. Kindly help
me in answering it. How many test cases are needed to
obtain 100% branch coverage. This question was asked in
ISTQB foudation level exam - Dec21 2008.

Read(A,C)

If(A<10) then Print A;

Endif

If(C>100) then Print C is greater then A

else if(C<100) then print only C

Endif else

Options -
a. 4
b. 3
c. 2
d. 1

Kindly answer with explanation so that it would be easy to
understand

Answer Posted / hima bindu

Number of testcases required for branch coverage will be 2.

In branch coverage we need to check whether all the
branches are exercised.
Here we have 3 branches all If statements we need to
consider.They are A<10,C>100,C<100

Line 1 - Read(A,C)
Line 2 - If(A<10) then
Line 3 - Print A;
Line 4 - Endif
Line 5 - If(C>100)then
Line 6 - Print C is greater then A
Line 7 - else if(C<100) then
Line 8 - print C
Line 9 - End if

So take the values as follows
Testcase 1 : A=5 and C=120
For this set of values Line1 - Line6 are executed

Now for the Line7 - Line9 to be executed take the value of
c as less than 100
So Testcase 2 : A=5(can be any value as Line 2,3,4 are
already exercised in testcase1)and c=80
For this set of values Line7-Line9 will be exercised

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you explian $ pillar of Agile

1006


What is the procedure of manual testing?

845


What are the main key components in client and server applications?

882


What a team leader will test first when s/he will get new module to test?

1770


What are the roles of glass-box and black-box testing tools?

1833






Hi, I want "Intergraph" placement papers for experienced people which was conducted recently in Hyderabad. Thanks, Purnima.

2139


what is a data guidelines?

1894


How can you do the usability testing?

913


WHAT IS OBJECT REPOSITORY? AND IT TYPES? HOW MANY TYPES OF ACTIONS ARE THERE IN QTP? CAN WE ADD NEW OBJECTS AND PROPERTIES INTO SHARED OBJECT REPOSITORY?

1641


How do you go about testing a project?

1722


Suggest some book to learn more test case???

1668


hi this is satish can some one help me out by sending the maxium notes on client sesrver ,web server and company architechture project hirearchy and company hirearchy i will happy to recive the answers as early as possible

1928


is it possible to do performance testing in stand alone application..how wil u do that ???????

1989


what is the general pattern of explanation of projects in interview, can u ans me plz.......... ex: online banking application

1802


Hi, Please can one tell me how to test the usability testing, which method has to be used, how to write the report? Thanks Deepa

1795