Software Engineering Software Testing and Quality Assurance 1 — Questions and Answers
Question 1: Which type of testing verifies that individual units or components of a software system work correctly in isolation?
- Integration Testing
- System Testing
- Unit Testing (Correct answer)
- Acceptance Testing
Correct answer: Unit Testing
Unit Testing tests individual components or functions in isolation to verify that each unit performs as expected.
Question 2: What is the primary purpose of regression testing?
- Test new features only
- Ensure that existing functionality still works after changes (Correct answer)
- Test performance under load
- Verify security vulnerabilities
Correct answer: Ensure that existing functionality still works after changes
Regression testing ensures that previously working functionality has not been broken by recent code changes or new features.
Question 3: In Test-Driven Development (TDD), what is the correct order of steps?
- Write code, write test, refactor
- Write test, write code, refactor (Correct answer)
- Write code, refactor, write test
- Refactor, write test, write code
Correct answer: Write test, write code, refactor
TDD follows the Red-Green-Refactor cycle: write a failing test first, write code to pass it, then refactor.
Question 4: Which testing technique tests the software without knowledge of its internal structure?
- White-box testing
- Gray-box testing
- Black-box testing (Correct answer)
- Glass-box testing
Correct answer: Black-box testing
Black-box testing evaluates software behavior without any knowledge of internal implementation or source code.
Question 5: What is a 'test double' in software testing?
- Running the same test twice
- A generic term for objects that stand in for real objects during testing (Correct answer)
- Two testers reviewing the same code
- A test that covers two requirements
Correct answer: A generic term for objects that stand in for real objects during testing
A test double is a generic term for any object used in place of a real object for testing purposes, including mocks, stubs, and fakes.
Question 6: Which metric measures the percentage of source code executed by a test suite?
- Defect density
- Test coverage (code coverage) (Correct answer)
- Mean time to failure
- Defect removal efficiency
Correct answer: Test coverage (code coverage)
Code coverage measures the percentage of production code that is exercised when a test suite runs, indicating how thoroughly the code is tested.
Which type of testing verifies that individual units or components of a software system work correctly in isolation?