CPSA Designing Building Blocks 3 — Questions and Answers
Question 1: Which diagram type in UML is most commonly used to show the static structure of building blocks and their relationships?
- Sequence diagram
- Component diagram (Correct answer)
- Activity diagram
- State machine diagram
Correct answer: Component diagram
UML component diagrams depict building blocks, their interfaces, and the dependencies between them at a structural level.
Question 2: The 'required interface' of a building block represents:
- The operations the block exposes to clients
- The services the block needs from other blocks to function (Correct answer)
- The block's internal API
- The database schema the block owns
Correct answer: The services the block needs from other blocks to function
A required interface specifies which services from other building blocks are needed for the block to fulfill its responsibilities.
Question 3: Which strategy BEST reduces the impact of change when a building block's implementation must be replaced?
- Using inheritance hierarchies
- Programming to interfaces rather than implementations (Correct answer)
- Maximizing the block's functionality
- Storing configuration in environment variables
Correct answer: Programming to interfaces rather than implementations
Programming to interfaces isolates consumers from implementation details, so replacing an implementation does not affect dependent blocks.
Question 4: In a layered architecture, which rule governs how building blocks in different layers may interact?
- Blocks may communicate freely across any layer
- Blocks may only depend on blocks in the same or lower layers (Correct answer)
- Blocks in lower layers may call upper layers via callbacks
- Blocks must communicate only through a central bus
Correct answer: Blocks may only depend on blocks in the same or lower layers
The layering rule requires that dependencies flow downward — a block may use blocks in the same layer or layers below it.
Question 5: What is a 'facade' building block used for in software architecture?
- To enforce security policies across subsystems
- To provide a simplified interface to a complex set of subsystems (Correct answer)
- To persist data in a relational database
- To monitor runtime performance of other blocks
Correct answer: To provide a simplified interface to a complex set of subsystems
A facade provides a unified, simplified interface to a complex subsystem, hiding its internal complexity from clients.
Question 6: Which of the following BEST describes the concept of 'information hiding' in building block design?
- Encrypting data at rest
- Concealing implementation details behind a stable interface (Correct answer)
- Removing debug logging from production
- Restricting database read permissions
Correct answer: Concealing implementation details behind a stable interface
Information hiding means implementation decisions are concealed behind an interface, limiting the impact of internal changes on other blocks.
Question 7: When designing building blocks, why should circular dependencies be avoided?
- They increase memory usage at runtime
- They make blocks impossible to test or reuse independently (Correct answer)
- They violate licensing requirements
- They prevent the use of design patterns
Correct answer: They make blocks impossible to test or reuse independently
Circular dependencies bind blocks together so neither can be tested, replaced, or reused without the other, undermining modularity.
Which diagram type in UML is most commonly used to show the static structure of building blocks and their relationships?