Algorithms Quality Control & Assurance 4 — Questions and Answers
Question 1: In mutation testing, what is a 'surviving mutant' an indicator of?
- A bug that was successfully fixed
- A code change not caught by any test, revealing a test gap (Correct answer)
- A high-performance optimization
- A passing edge-case test
Correct answer: A code change not caught by any test, revealing a test gap
A surviving mutant means the test suite failed to detect an injected code defect, exposing a gap in test coverage or assertion strength.
Question 2: What is the primary benefit of continuous integration (CI) for algorithm quality?
- Reducing the number of developers needed
- Automatically running tests on every code commit to catch issues early (Correct answer)
- Eliminating the need for code reviews
- Speeding up algorithm execution in production
Correct answer: Automatically running tests on every code commit to catch issues early
CI pipelines run the full test suite on each commit, catching defects immediately after they are introduced rather than later in the cycle.
Question 3: Which practice involves reviewing each other's code before merging to catch defects early?
- Pair programming
- Peer code review (Correct answer)
- Canary deployment
- A/B testing
Correct answer: Peer code review
Peer code review has another developer inspect submitted code for bugs, style issues, and logical errors before it is merged into the main branch.
Question 4: What does 'branch coverage' in testing require?
- Every function is called at least once
- Every possible branch (true/false) of every decision is executed (Correct answer)
- All loops execute at least 100 iterations
- Every variable is initialized
Correct answer: Every possible branch (true/false) of every decision is executed
Branch coverage requires that each true and false outcome of every conditional statement is exercised by the test suite at least once.
Question 5: What is the key difference between verification and validation in software quality?
- Verification checks correctness against specs; validation confirms it meets user needs (Correct answer)
- Verification uses dynamic tests; validation uses static analysis
- Verification is automated; validation is manual
- Verification is done by QA; validation by developers
Correct answer: Verification checks correctness against specs; validation confirms it meets user needs
Verification asks 'Are we building the product right?' (spec conformance), while validation asks 'Are we building the right product?' (user need fulfillment).
Question 6: Which test double returns hardcoded responses and makes no assertions about how it is called?
- Mock
- Stub (Correct answer)
- Spy
- Fake
Correct answer: Stub
A stub provides fixed, pre-programmed responses to calls made during a test but does not verify whether or how it was called.
Question 7: In load testing for algorithms, what is the primary metric being observed?
- Number of test cases written
- System performance and stability under expected and peak workloads (Correct answer)
- Code readability score
- Ratio of passes to failures
Correct answer: System performance and stability under expected and peak workloads
Load testing measures throughput, latency, and resource usage as the number of concurrent requests or data volume approaches realistic peaks.
In mutation testing, what is a 'surviving mutant' an indicator of?