0
0
Software Engineeringknowledge~20 mins

Code coverage metrics in Software Engineering - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Code Coverage Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Code Coverage Types

Which type of code coverage measures whether each decision point (like an if statement) has been evaluated both true and false during testing?

ABranch coverage
BStatement coverage
CFunction coverage
DPath coverage
Attempts:
2 left
💡 Hint

Think about coverage that checks all possible outcomes of decisions.

📋 Factual
intermediate
1:30remaining
Code Coverage Metric Calculation

If a program has 100 executable statements and a test suite executes 85 of them, what is the statement coverage percentage?

A85%
B15%
C100%
D75%
Attempts:
2 left
💡 Hint

Coverage percentage = (executed statements / total statements) * 100

🔍 Analysis
advanced
2:30remaining
Interpreting Low Branch Coverage

A test suite shows 90% statement coverage but only 50% branch coverage. What does this most likely indicate about the tests?

ATests are missing many functions and statements
BAll functions are tested but some lines are not executed
CTests cover all decision outcomes but miss some statements
DMost lines run but some decision outcomes are not tested
Attempts:
2 left
💡 Hint

Think about what branch coverage measures compared to statement coverage.

Comparison
advanced
2:30remaining
Comparing Path Coverage and Branch Coverage

Which statement best describes the difference between path coverage and branch coverage?

APath coverage only tests function calls, branch coverage tests statements.
BPath coverage tests all possible sequences of branches, while branch coverage tests each branch once.
CBranch coverage tests all possible sequences of branches, while path coverage tests each branch once.
DBranch coverage measures code complexity, path coverage measures test duration.
Attempts:
2 left
💡 Hint

Consider how many combinations of branches each coverage type requires.

Reasoning
expert
3:00remaining
Impact of 100% Statement Coverage on Software Quality

If a software project achieves 100% statement coverage but still has bugs, what is the most likely reason?

AThe coverage tool is malfunctioning and reporting wrong results.
BThe code has syntax errors that coverage tools cannot detect.
CTests do not cover all possible input values and decision outcomes.
D100% statement coverage guarantees no bugs exist.
Attempts:
2 left
💡 Hint

Think about what statement coverage measures and what it does not.