Skip to content

This textbook is in beta – content is actively being refined. Report issues or suggestions

06.05 Testing Unit Subsystem System And Quality Assurance - Quiz

Check your understanding

  1. What is the primary purpose of unit testing in object-oriented programming?

    • To test the entire system from end to end
    • To test individual methods and classes in isolation { data-correct }
    • To test user interface components
    • To test database connections
  2. Which characteristic is most important for a good unit test?

    • It should test multiple classes at once
    • It should connect to external databases
    • It should be independent and repeatable { data-correct }
    • It should take several minutes to run
  3. In the Python unittest setUp method?framework, what is the purpose of the

    • To clean up after all tests are complete
    • To configure test fixtures before each test method runs { data-correct }
    • To run the actual test logic
    • To generate test reports
  4. What type of testing focuses on verifying that different classes work correctly when combined?

    • Unit testing
    • System testing
    • Subsystem (integration) testing { data-correct }
    • Acceptance testing
  5. Which assertion would be most appropriate to test that a method raises a specific exception?

    • self.assertEqual(exception, ValueError)
    • self.assertTrue(method_raises_error())
    • with self.assertRaises(ValueError): method_call() { data-correct }
    • self.assertIsNone(method_call())
  6. What is the main focus of system testing?

    • Testing individual methods in isolation
    • Testing complete user workflows and business requirements { data-correct }
    • Testing only error conditions
    • Testing code performance and speed
  7. In Test-Driven Development (TDD), when should you write the tests?

    • After implementing all the functionality
    • Before implementing the functionality { data-correct }
    • Only when bugs are discovered
    • At the end of the project
  8. What should a good code review checklist for object-oriented code include?

    • Only syntax and formatting rules
    • Single responsibility, encapsulation, clear naming, and test coverage { data-correct }
    • Only performance optimization checks
    • Only documentation requirements
  9. Which of the following best describes acceptance criteria?

    • Technical specifications for developers only
    • Performance benchmarks for system speed
    • Clear definitions of when features are considered complete and working { data-correct }
    • Documentation standards for code comments
  10. What is the most important benefit of maintaining a continuous testing mindset?

    • It reduces the need for documentation
    • It catches problems early and builds confidence in code changes { data-correct }
    • It eliminates the need for code reviews
    • It makes development faster by skipping planning phases