CS Testing & Quality Assurance 2 — Questions and Answers
Question 1: A tester designs test cases using only the software's specification, without access to source code. Which technique is this?
- Black-box testing (Correct answer)
- White-box testing
- Mutation testing
- Static analysis
Correct answer: Black-box testing
Black-box testing derives test cases from external specifications without knowledge of internal code structure.
Question 2: Which coverage criterion requires that every boolean sub-expression in a decision be evaluated to both true and false?
- Condition coverage (Correct answer)
- Statement coverage
- Path coverage
- Function coverage
Correct answer: Condition coverage
Condition coverage requires each atomic boolean condition to take both true and false values during testing.
Question 3: A function accepts ages from 18 to 65 inclusive. Using boundary value analysis, which set of inputs is most appropriate to test?
- 17, 18, 65, 66 (Correct answer)
- 20, 30, 40, 50
- 0, 100, 200, 300
- 18, 19, 20, 21
Correct answer: 17, 18, 65, 66
Boundary value analysis tests values at and immediately around the valid range's edges, where defects cluster.
Question 4: In test-driven development (TDD), what is the correct order of steps?
- Write a failing test, write code to pass it, refactor (Correct answer)
- Write code, write tests, refactor
- Refactor, write tests, write code
- Write all tests, then write all code
Correct answer: Write a failing test, write code to pass it, refactor
TDD follows the red-green-refactor cycle: a failing test first, minimal passing code, then refactoring.
Question 5: Which type of testing verifies that a recent code change has not broken existing functionality?
- Regression testing (Correct answer)
- Acceptance testing
- Smoke testing
- Usability testing
Correct answer: Regression testing
Regression testing re-runs existing tests after changes to confirm previously working behavior is intact.
Question 6: A test double that records how it was called so assertions can verify interactions is best described as a what?
- Spy (Correct answer)
- Dummy
- Fixture
- Oracle
Correct answer: Spy
A spy wraps or records calls made to it, allowing tests to assert on interaction details afterward.
Question 7: Which statement best describes the difference between verification and validation?
- Verification checks the product is built right; validation checks the right product is built (Correct answer)
- Verification is manual; validation is automated
- Verification happens after release; validation before
- Verification tests hardware; validation tests software
Correct answer: Verification checks the product is built right; validation checks the right product is built
Verification checks conformance to specifications, while validation checks that the software meets actual user needs.
A tester designs test cases using only the software's specification, without access to source code.
Which technique is this?