Question: Consider the following two program fragments: Fragment 1: found:= false; counter:= 1; while (counter < n) and (not found) do if table[counter] = element then

Consider the following two program fragments:

Fragment 1:

found:= false; counter:= 1;

while (counter < n) and (not found)

do if table[counter] = element then found:= true end;

counter:= counter + 1 end;

if found then writeln (”found”) else writeln (”not found”) end;

Fragment 2:

found:= false; counter:= 1;

while (counter < n) and (not found)

do found:= table[counter] = element;

counter:= counter + 1 end;

if found then writeln (”found”) else writeln (”not found”) end;

Can the same test set be used if we wish to achieve a 100% branch coverage for both fragments?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Software Testing And Quality Assurance Questions!