ISTQB White-Box Test Design 2 — Questions and Answers
Question 1: Which coverage criterion requires that every loop in the code is executed at least once with zero iterations, one iteration, and multiple iterations?
- Statement coverage
- Branch coverage
- Loop coverage (Correct answer)
- Path coverage
Correct answer: Loop coverage
Loop coverage specifically targets loop constructs by requiring execution with zero, one, and multiple iterations to reveal off-by-one and boundary errors.
Question 2: A developer has written a function with 5 independent conditions in a single compound predicate. How many test cases are needed for Modified Condition/Decision Coverage (MC/DC)?
- 32
- 10
- 6 (Correct answer)
- 16
Correct answer: 6
MC/DC requires N+1 test cases for N independent conditions, so 5 conditions require 6 test cases.
Question 3: In control flow testing, what is a 'predicate' node?
- A node that represents a function call
- A node where the flow splits based on a condition (Correct answer)
- A node that merges two execution paths
- A node representing a variable assignment
Correct answer: A node where the flow splits based on a condition
A predicate node is a decision point in the control flow graph where execution can follow different paths based on a Boolean condition.
Question 4: Which white-box technique is MOST suitable for testing code that contains nested if-else structures with complex boolean expressions?
- Statement coverage
- Decision coverage
- MC/DC coverage (Correct answer)
- Data flow coverage
Correct answer: MC/DC coverage
MC/DC is specifically designed to independently test each condition within complex Boolean expressions, making it ideal for nested conditionals.
Question 5: A tester achieves 100% statement coverage on a module. What can they conclude?
- All branches have been tested
- All paths have been tested
- Every executable statement was executed at least once (Correct answer)
- All conditions evaluated to both true and false
Correct answer: Every executable statement was executed at least once
100% statement coverage only guarantees every executable statement was executed at least once; branches and paths may remain untested.
Question 6: In data flow testing, a 'kill' (k-use) of a variable occurs when:
- The variable is assigned a new value, overwriting the previous one (Correct answer)
- The variable is read inside a predicate
- The variable is used in a computation
- The variable is passed as a parameter
Correct answer: The variable is assigned a new value, overwriting the previous one
A kill or definition-kill occurs when a variable is re-defined or assigned a new value, terminating the previous definition's reach.
Question 7: Which metric is used to estimate the minimum number of independent paths in a program and thus the minimum test cases for path coverage?
- Lines of code
- Cyclomatic complexity (Correct answer)
- Fan-out number
- Halstead volume
Correct answer: Cyclomatic complexity
Cyclomatic complexity (V(G) = E - N + 2P) gives the number of linearly independent paths through the code.
Which coverage criterion requires that every loop in the code is executed at least once with zero iterations, one iteration, and multiple iterations?