Download Software Architecture And Design Exam 1 | Complete Design Patterns And Python Code and more Exams Nursing in PDF only on Docsity!
Software Architecture And Design Exam 1 |
Complete Design Patterns And Python Code
Refactoring Exemplar With Answers And
Rationales | 2026 Updated
TABLE OF CONTENTS
| Section | Topic | Questions | | I | Software Architecture Foundations & Quality Attributes | 1–70 | | II | SOLID Principles & Design Fundamentals | 71–140 | | III | GoF Design Patterns (Creational, Structural, Behavioral) | 141– 230 | | IV | Python Code Refactoring & Code Smells | 231–300 | | V | Architecture Documentation, Evaluation & System Decomposition | 301–350 | SECTION I: SOFTWARE ARCHITECTURE FOUNDATIONS & QUALITY ATTRIBUTES (Questions 1–70)
- What is the primary role of a Repository in domain-driven design? A. To manage user interfaces and interactions B. To provide an abstraction for storing and retrieving domain concepts C. To handle network communications between services D. To enforce security protocols in software applications Answer: B Explanation: A Repository mediates between the domain and data mapping layers, acting like an in-memory collection of domain objects while abstracting persistence. It does not manage UI, network, or security concerns.
- How does a Repository contribute to aggregate integrity in DDD? A. By allowing direct access to individual entities without restrictions B. By ensuring aggregates are persisted as a whole and maintaining their consistency C. By separating the data access layer from the business logic layer D. By facilitating communication between different software components Answer: B
Answer: B Explanation: Cost per line of code quantifies the economic effort of producing code, aiding budgeting and productivity analysis. It does not measure code volume, architecture quality, or system performance directly.
- If a team implements a quick workaround instead of a robust solution, what is a likely long-term consequence? A. Increased user satisfaction due to faster delivery B. A reduction in overall project costs C. Accumulation of technical debt requiring future rework D. Improved communication among team members Answer: C Explanation: Quick workarounds introduce technical debt, which increases maintenance costs and future rework.
- Which of the following best defines “software architecture” according to the SEI formulation? A. A set of UML diagrams that document the components in a system
B. The set of structures needed to reason about a system, encompassing elements, their externally visible properties, and relationships among them C. The implementation blueprint that developers follow when writing code D. A collection of design patterns applied to solve recurring problems Answer: B Explanation: The SEI definition emphasizes structures (plural), reasoning (architecture as a cognitive tool), and externally visible properties (observable at interfaces, not internal implementation details).
- An asynchronous Kafka topic is best classified as which architectural element? A. A component B. A connector C. A data store D. A deployment node Answer: B
B. A viewpoint is the specification (the “recipe”); a view is the artifact produced by applying that specification to a specific system (the “dish”) C. A viewpoint shows runtime behavior; a view shows static structure D. A viewpoint is informal; a view is a formal, machine-processable document Answer: B Explanation: A viewpoint defines the rules—what elements to show and what relationships matter. A view is the actual artifact produced by applying those rules to a specific system.
- Why does software architecture require multiple views rather than a single comprehensive diagram? A. Because different stakeholders have different concerns that cannot be captured in one diagram B. Because UML does not support comprehensive diagrams C. Because a single diagram would be too large to print D. Because views are only for documentation, not design Answer: A
Explanation: Architecture must address multiple stakeholder concerns (security, performance, modifiability, etc.). No single diagram can capture all relevant structures and their relationships.
- What is the definition of software architecture? A. The high-level structure of a software system, defining its components and their interactions B. The detailed implementation of each module C. The user interface design D. The database schema Answer: A Explanation: Software architecture is the high-level structure of a software system, defining its components and their interactions.
- What is the Model-View-Controller (MVC) pattern? A. An architectural pattern separating data, user interface, and control logic B. A creational pattern for object instantiation C. A structural pattern for class composition D. A concurrency pattern
Answer: A Explanation: Fault-tolerant designs use redundancy, error handling, and recovery mechanisms to continue operating after failures.
- What is the difference between horizontal and vertical scaling? A. Horizontal scaling adds more machines; vertical scaling adds resources to a single machine B. Horizontal scaling adds CPU; vertical scaling adds memory C. Horizontal scaling is for databases; vertical scaling is for applications D. Horizontal scaling is cheaper; vertical scaling is more expensive Answer: A Explanation: Horizontal scaling distributes load across more machines; vertical scaling enhances a single machine’s resources.
- What is the purpose of interface design in software architecture? A. To define clear contracts between modules B. To make the code run faster C. To reduce the number of classes
D. To eliminate documentation Answer: A Explanation: Interfaces specify how modules communicate, reducing coupling and improving modularity.
- Design is primarily about: A. Writing as much code as possible B. Making change safe and affordable over time C. Meeting the deadline at any cost D. Using the newest technologies Answer: B Explanation: Good design focuses on making future changes safe and affordable, not just on initial delivery.
- Most software cost is in: A. Writing the initial code B. Modifying code over its lifetime C. Testing only D. Deployment
Answer: A Explanation: UML class diagrams depict the static structure of a system—classes, attributes, methods, and relationships—not dynamic execution flow.
- Which of the following is a quality attribute requirement, not a functional requirement? A. “The system must allow users to reset their password via email.” B. “The system must calculate quarterly tax liability from submitted transactions.” C. “The password reset flow must complete in under 3 seconds for 99% of requests.” D. “The system must store customer orders in a relational database.” Answer: C Explanation: A quality attribute requirement specifies how well the system does something. “Under 3 seconds for 99% of requests” is a performance quality attribute requirement. Options A, B, and D specify what the system must do.
- The SEI quality attribute taxonomy divides attributes into two major categories. Which pair correctly labels these categories? A. Functional attributes and non-functional attributes B. Runtime attributes (e.g., availability) and development-time attributes (e.g., modifiability) C. User-facing attributes and system-facing attributes D. Static attributes and dynamic attributes Answer: B Explanation: The SEI taxonomy groups quality attributes into runtime attributes (observable in a running system) and development-time attributes (manifest during development and operations).
- Which quality attribute conflict is specifically caused by the CAP theorem? A. Security vs. usability B. Modifiability vs. performance C. Scalability vs. consistency D. Deployability vs. reliability Answer: C
B. Architecture is done by senior engineers; design is done by junior engineers. C. Architecture is only for large systems; design is only for small systems. D. Architecture is about code; design is about documentation. Answer: A Explanation: Architecture addresses the high-level cooperation of components and processes, while design focuses on the internal structure of individual modules.
- What is the primary focus of software architecture? A. Defect prediction B. The major components, their relationships, and how they interact C. Writing efficient algorithms D. Selecting a programming language Answer: B Explanation: Software architecture describes a system’s major components, their relationships (structures), and how they interact with each other.
- Which architectural pattern is characterized by a client-server model and layered structure? A. Microservices B. Layered architecture C. Event-driven architecture D. Monolithic architecture Answer: B Explanation: Layered architecture organizes components into horizontal layers, often used in client-server systems.
- What is the purpose of architectural tactics? A. To document the architecture B. To achieve quality attribute requirements C. To generate code automatically D. To test the system Answer: B Explanation: Architectural tactics are design decisions that help achieve specific quality attribute requirements (e.g., using redundancy for availability).
Explanation: Syntax highlighting is a tooling feature, not an architectural quality attribute.
- What is a component in software architecture? A. A deployable unit of software B. A connector between systems C. A data store D. A quality attribute Answer: A Explanation: A component is a modular, deployable, and replaceable part of a system that encapsulates implementation and exposes interfaces.
- What is the role of connectors in software architecture? A. To perform business logic B. To mediate communication between components C. To store data D. To define quality attributes Answer: B
Explanation: Connectors are interaction mechanisms that mediate communication between components (e.g., API calls, message queues).
- What is architecture erosion? A. The gradual deviation of the implemented system from its intended architecture B. The process of refactoring architecture C. The documentation of architecture D. The evaluation of architecture Answer: A Explanation: Architecture erosion occurs when the actual code drifts from the intended architecture over time.
- What is the purpose of architecture evaluation? A. To assess whether the architecture meets quality attribute requirements B. To generate code from models C. To deploy the system D. To write documentation