ISTQB White-Box Test Design 4 — Questions and Answers
Question 1: Which of the following scenarios would ONLY be detected by condition coverage but NOT by decision coverage alone?
- A branch that is never executed
- A fault where one sub-condition in an OR expression is always true, masking a faulty second sub-condition (Correct answer)
- An infinite loop with no exit condition
- A missing return statement at the end of a function
Correct answer: A fault where one sub-condition in an OR expression is always true, masking a faulty second sub-condition
If one sub-condition in an OR expression is always true, the compound decision always evaluates to true, so decision coverage is satisfied, but the faulty second sub-condition is never exercised as false.
Question 2: In the context of white-box testing, what is 'code instrumentation'?
- Adding musical metaphors to code comments
- Inserting probes or counters into source code to measure coverage during execution (Correct answer)
- Compiling code with optimization flags disabled
- Replacing production code with stubs during testing
Correct answer: Inserting probes or counters into source code to measure coverage during execution
Code instrumentation inserts measurement probes into the source or bytecode to track which statements, branches, or conditions are executed during test runs.
Question 3: A program has a cyclomatic complexity of 8. What does this imply about its testability?
- The program requires exactly 8 test cases to achieve full statement coverage
- There are at least 8 independent paths requiring at least 8 test cases for basis path coverage (Correct answer)
- The program has 8 decision points and cannot be unit tested
- The program has 8 bugs that need to be fixed
Correct answer: There are at least 8 independent paths requiring at least 8 test cases for basis path coverage
Cyclomatic complexity of 8 means there are 8 linearly independent paths, requiring at least 8 test cases to achieve basis path (path) coverage.
Question 4: Which white-box technique is MOST appropriate when testing safety-critical avionics software that must comply with DO-178C Level A?
- Statement coverage (100%)
- Decision coverage (100%)
- MC/DC coverage (100%) (Correct answer)
- Path coverage (100%)
Correct answer: MC/DC coverage (100%)
DO-178C Level A (most critical) mandates 100% MC/DC coverage because it provides rigorous testing of each condition's independent effect on decisions.
Question 5: Which statement about 'dead code' is TRUE in the context of white-box testing?
- Dead code always causes test failures
- Dead code is code that executes only under error conditions
- Dead code can never be executed regardless of the input, and 100% coverage reveals its presence by impossibility (Correct answer)
- Dead code is automatically removed by the compiler
Correct answer: Dead code can never be executed regardless of the input, and 100% coverage reveals its presence by impossibility
Dead code is unreachable code that no test input can execute; attempting to achieve 100% coverage exposes dead code because its coverage remains at 0% despite all efforts.
Question 6: A white-box tester uses a control flow graph and identifies 3 independent paths. After executing test cases covering all 3 paths, which statement is MOST accurate?
- The software is defect-free
- All equivalence partitions have been tested
- All linearly independent execution paths have been exercised at least once (Correct answer)
- All boundary conditions have been validated
Correct answer: All linearly independent execution paths have been exercised at least once
Covering all independent paths means basis path testing is complete, but it does not guarantee absence of defects or coverage of all equivalence classes.
Question 7: In data flow testing, which anomaly is considered MOST serious from a defect perspective?
- dd anomaly — a variable is defined twice without an intervening use
- du anomaly — a variable is defined but never used
- ur anomaly — a variable is used without a prior definition (Correct answer)
- ku anomaly — a variable is killed (overwritten) after use
Correct answer: ur anomaly — a variable is used without a prior definition
A ur anomaly (use before definition) is most serious because reading an undefined variable produces unpredictable, potentially dangerous behavior at runtime.
Which of the following scenarios would ONLY be detected by condition coverage but NOT by decision coverage alone?