Consider the following two program fragments: Fragment 1: found:= false; counter:= 1; while (counter < n) and

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 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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: