Algorithms Quality Control & Assurance 2 — Questions and Answers
Question 1: Which testing technique executes code without knowledge of internal structure, focusing solely on inputs and outputs?
- White-box testing
- Black-box testing (Correct answer)
- Gray-box testing
- Mutation testing
Correct answer: Black-box testing
Black-box testing treats the system as opaque, validating behavior purely from external inputs and expected outputs.
Question 2: In algorithm quality assurance, what does 'code coverage' measure?
- Number of bugs found per line
- Percentage of source code executed during testing (Correct answer)
- Lines of code written per hour
- Ratio of comments to code
Correct answer: Percentage of source code executed during testing
Code coverage measures what fraction of the codebase is actually executed by the test suite, guiding where more tests are needed.
Question 3: What is a 'regression test' in software quality assurance?
- A test that measures algorithmic complexity
- A test re-run after changes to confirm existing features still work (Correct answer)
- A statistical method to find performance trends
- A test that runs before any code is written
Correct answer: A test re-run after changes to confirm existing features still work
Regression tests re-execute previously passing tests after a code change to ensure new modifications haven't broken existing functionality.
Question 4: Which property of a good test suite ensures each test case checks one specific behavior?
- Completeness
- Atomicity (Correct answer)
- Redundancy
- Scalability
Correct answer: Atomicity
Atomic tests check a single behavior so that a failure pinpoints exactly which behavior broke, making debugging faster.
Question 5: What is the purpose of a 'smoke test' in algorithmic quality control?
- To test every edge case thoroughly
- To quickly verify the most critical functions work before deeper testing (Correct answer)
- To measure memory usage under load
- To document algorithm complexity
Correct answer: To quickly verify the most critical functions work before deeper testing
Smoke tests perform a shallow check of core functionality to decide whether the build is stable enough for more thorough testing.
Question 6: In property-based testing, what does the framework generate automatically?
- Code documentation
- Random inputs to validate invariants (Correct answer)
- Performance benchmarks
- Deployment scripts
Correct answer: Random inputs to validate invariants
Property-based testing frameworks like QuickCheck automatically generate many random inputs to verify that a stated property always holds.
Question 7: Which metric directly measures the number of independent paths through a program's control flow?
- Lines of code
- Cyclomatic complexity (Correct answer)
- Halstead volume
- Fan-out
Correct answer: Cyclomatic complexity
Cyclomatic complexity counts the number of linearly independent paths through code, indicating how many test cases are needed for full branch coverage.
Which testing technique executes code without knowledge of internal structure, focusing solely on inputs and outputs?