ITPEC FE Morning April 2019 Question 49
ITPEC FE Morning April 2019 — Question 49 of 80
Branch Coverage — minimum test cases to cover all True/False branches.
Two decision points in the flowchart:
- Decision 1: X > 1 → True / False
- Decision 2: A = 2 or B = 0 → True / False
Branch coverage requires every branch (True and False) of every decision to be executed at least once.
Test case 1: X = 4, A = 2, B = 1
- Decision 1: True → X ÷ 2 = 2 → loop back
- Decision 1: True → X ÷ 2 = 1 → loop back
- Decision 1: False → proceed
- Decision 2: True (A = 2) → X + 1 → loop back
Test case 2: X = 1, A = 1, B = 1
- Decision 1: False → proceed
- Decision 2: False → exit
All 4 branches covered → minimum is 2.
Why not others:
- (a) 1 — cannot cover both True and False of the same decision in one pass
- (c) 3 — more than needed
- (d) 4 — more than needed
Key rule: Branch coverage = cover every edge from every decision node. Count the decisions, then find the minimum set of paths that hits all True/False branches.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.