CPA Software Development & Design Principles 3 — Questions and Answers
Question 1: What does 'coupling' measure in software design?
- How well a module performs its task
- The degree of interdependence between modules (Correct answer)
- The number of methods in a class
- The complexity of an algorithm
Correct answer: The degree of interdependence between modules
Coupling measures the degree to which one module depends on or knows about another module.
Question 2: Which principle in object-oriented design states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application?
- Open/Closed Principle
- Interface Segregation Principle
- Liskov Substitution Principle (Correct answer)
- Dependency Inversion Principle
Correct answer: Liskov Substitution Principle
The Liskov Substitution Principle (LSP) states that subclasses must be substitutable for their base classes without altering program correctness.
Question 3: What type of testing verifies that individual components of a system work correctly in isolation?
- Integration testing
- System testing
- Unit testing (Correct answer)
- Acceptance testing
Correct answer: Unit testing
Unit testing focuses on verifying that individual units or components of software work as expected in isolation.
Question 4: In software architecture, what is a microservices architecture characterized by?
- A single deployable unit with all functionality
- Small, independently deployable services communicating via APIs (Correct answer)
- Shared database among all application modules
- A layered architecture with strict module boundaries
Correct answer: Small, independently deployable services communicating via APIs
Microservices architecture structures an application as a collection of small, loosely coupled services that communicate via well-defined APIs.
Question 5: Which version control workflow involves each developer working on a dedicated long-running branch for a feature?
- Trunk-based development
- GitFlow
- Feature branch workflow (Correct answer)
- Forking workflow
Correct answer: Feature branch workflow
The Feature Branch Workflow has developers create a dedicated branch for each feature, keeping the main branch stable.
Question 6: What is the Observer design pattern primarily used for?
- Creating objects without specifying their concrete class
- Defining a one-to-many dependency so that when one object changes state, all dependents are notified (Correct answer)
- Providing a surrogate for another object to control access
- Encapsulating a request as an object
Correct answer: Defining a one-to-many dependency so that when one object changes state, all dependents are notified
The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Question 7: What does the acronym DRY stand for in software development principles?
- Design, Review, Yield
- Don't Repeat Yourself (Correct answer)
- Define, Refactor, Yield
- Dynamic Runtime Yield
Correct answer: Don't Repeat Yourself
DRY (Don't Repeat Yourself) is a principle aimed at reducing repetition of code patterns by replacing duplicated logic with abstractions.
What does 'coupling' measure in software design?