ExamGecko
Question list
Search
Search

Related questions











Question 185 - CTFL-2018 discussion

Report
Export

Consider the following pseudo-code

How many minimum test cases are required to cover 100% Statement coverage and Decision coverage?

A.
5 for Statement, 5 for Decision
Answers
A.
5 for Statement, 5 for Decision
B.
4 for Statement, 5 for Decision
Answers
B.
4 for Statement, 5 for Decision
C.
8 for Statement, 6 for Decision
Answers
C.
8 for Statement, 6 for Decision
D.
6 for Statement, 8 for Decision
Answers
D.
6 for Statement, 8 for Decision
Suggested answer: B

Explanation:

To cover 100% statement coverage, we need to execute every statement in the code at least once. To cover 100% decision coverage, we need to execute every branch in the code at least once. The minimum number of test cases required to achieve both statement and decision coverage is 4 for statement and 5 for decision. Here is one possible set of test cases:

| Test Case | Input | Output | Statement Coverage | Decision Coverage | | TC1 | Walking = True, Midnight = False, Raining = False, Running = False | Take umbrella | S1, S2, S3, S4, S5 | D1-T, D2-T | | TC2 | Walking = False, Midnight = True, Raining = False, Running = False | Search light | S1, S2, S6, S7 | D1-F, D3-T | | TC3 | Walking = False, Midnight = False, Raining = True, Running = False | Take umbrella and search light | S1, S2, S6, S8, S9 | D1-F, D3-F, D4-T | | TC4 | Walking = False, Midnight = False, Raining = False, Running = True | Keep doing what you were doing | S1, S2, S6, S8, S10 | D1-F, D3-F, D4-F |

asked 18/09/2024
Vincent Meuldijk
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first