Multiple choice technology testing

How many test cases would be required to cover all the decisions in following program?READ A READ B IF A>= 10 THEN PRINT A; ELSEIF B>5 THEN PRINT B IS SMALL; ELSEIF A>B THEN PRINT A IS BIGGER THEN B; ELSE IF B>A THEN PRINT B; ELSE PRINT NULL ;END IF; END IF; END IF; END IF;

  1. 8

  2. 5

  3. 7

  4. 6

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This program has 5 decision points (IF A>=10, ELSEIF B>5, ELSEIF A>B, ELSE IF B>A, and the implicit ELSE). To achieve decision coverage, each decision must be tested with both true and false outcomes. The minimum 5 test cases are: (1) A>=10 true, (2) A<10, B>5 true, (3) A<10, B<=5, A>B true, (4) A<10, B<=5, A<=B, B>A true, (5) All conditions false (A=B). Option A (8) is for multiple condition coverage, while C (7) and D (6) don't account for all decision branches.