GATE 2010 CS (CS1) – Question 54
Choose the tests giving statement coverage of:
if (a==b) { S1; exit; }
else if (c==d) { S2; }
else { S3; exit; }
S4;T1: a=b=c=d. T2: a,b,c,d all distinct. T3: a=b and c≠d. T4: a≠b and c=d.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) T1,T2,T4
Explanation
S1 is reached by T1 or T3. S3 needs a≠b and c≠d, supplied by T2. S2 and the following S4 need a≠b,c=d, supplied by T4. Thus all three path types are necessary; among the options, T1,T2,T4 is the complete set, D.