Exercises
Explore mutation testing, a fault-based technique for evaluating how effectively a test suite detects small changes in program behavior. This quiz covers mutant generation, killed and surviving mutants, mutation scores, equivalent mutants, strong and weak mutation, operator selection, subsumption, boundary testing, and practical CI optimization. Questions range from foundational concepts to code-based scenarios and interpretation of mutation testing results.
Answer the questions below and check the explanation for each answer.
0/20 answered
Auto audio on: the next questions will be read aloud when you click Continue.
A mutant is created by making a small syntactic change to the program. An effective test suite should detect the resulting behavioral difference.
A mutant is killed when at least one test produces a different result for the mutant than for the original program.
A surviving non-equivalent mutant represents a changed behavior that the current tests did not expose, indicating a possible weakness in the test suite.
The score is 88 divided by 110 relevant mutants: 88 / (120 - 10) = 0.80, or 80%.
For integers, returning x + 0 and returning x have the same behavior. No test can distinguish them, so the mutant is equivalent.
Strong mutation requires the mutation's effect to propagate to an observable output or behavior that causes a test to fail.
Replacing one relational operator with another, such as changing > to >=, is a standard mutation operator.
At age 18, the original condition is false but the mutated condition is true. This boundary value exposes the behavioral difference.
The coupling effect proposes that complex faults are often coupled to simpler faults, so tests that kill simple mutants may also detect complex defects.
Historical mutant-killing data can help prioritize tests that are more likely to detect meaningful changes early in the test run.
A flaky test can fail without being affected by a mutation, producing unreliable classifications and misleading mutation scores.
If at least one previously passing test fails against the mutant, the test suite has detected the change and the mutant is killed.
M2 is killed by a smaller set of tests, so fewer tests can distinguish it from the original program. It is therefore harder for this suite to kill.
A 100% score applies only to the selected mutation operators and analyzed mutants. It does not prove that the software is defect-free.
Selective mutation lowers execution cost by applying a smaller set of mutation operators that still provides useful evidence about test effectiveness.
For 0 and 5, the original returns 5 while the mutant returns -5. The other inputs produce identical results in both versions.
Timeouts may indicate meaningful behavior such as an infinite loop, but they can also reflect infrastructure issues. A consistent policy and investigation are needed.
Coverage shows which code was executed. Mutation testing goes further by evaluating whether tests can detect deliberately introduced behavioral changes.
With a nonmember and a total of 60, the original conjunction is false while the mutated disjunction is true, so the test kills the mutant.
Incremental analysis limits mutation to relevant changes, while cached test mappings help select affected tests and reduce CI execution time.
Video Courses
Advanced
recommended
recommended
Ideal for beginners
Thousands of online courses in video, ebooks and audiobooks.
To test your knowledge during online courses
Generated directly from your cell phone's photo gallery and sent to your email
Download our app via QR Code or the links below:.
+ 10 million
students
Free and Valid
Certificate
60 thousand free
exercises
4.8/5 rating in
app stores
Free courses in
video and ebooks