Problem 1
Select the TWO (2) methodologically sound statements regarding the SOLID object-oriented software design principles and maintainable software architecture.
- AThe Single Responsibility Principle (SRP) asserts that a software class or module should have one, and only one, reason to change, meaning it must encapsulate a single, highly cohesive responsibility.
- BThe Liskov Substitution Principle (LSP) permits derived subclasses to restrict or strengthen preconditions on inherited methods, even if this prevents the subclass from substituting for its parent class.
- CThe Open/Closed Principle (OCP) states that software entities (classes, modules, functions) should be open for extension (e.g., via inheritance or interfaces) but closed for modification.
- DIn microservice design, tight compile-time coupling and shared database tables across independent bounded contexts are recommended best practices to maximize code reuse.
Show the solution
**Step 1: Evaluate Statement A (Single Responsibility Principle - SRP)** True. From the FE Reference Handbook (Software Engineering / Object-Oriented Principles): Formulated by Robert C. Martin, the Single Responsibility Principle states that a class should have one, and only one, reason to change. High cohesion and single responsibility reduce coupling and prevent unintended side-effects across features. Statement A is correct. **Step 2: Evaluate Statement B (Liskov Substitution Principle - LSP)** False. Formulated by Barbara Liskov, LSP requires that objects of a superclass should be replaceable with objects of a subclass without altering the correctness of the program. A subclass must NOT strengthen preconditions (it cannot demand more than the parent) nor weaken postconditions. Statement B is incorrect. **Step 3: Evaluate Statement C (Open/Closed Principle - OCP)** True. Formulated by Bertrand Meyer, OCP states that software entities should be open for extension but closed for modification. This allows adding new functionality by creating new classes implementing existing interfaces/abstractions without editing and re-testing established, validated production code. Statement C is correct. **Step 4: Evaluate Statement D (Microservice Architectural Coupling)** False. High cohesion and loose coupling are foundational principles of microservices. Sharing databases and creating tight compile-time coupling across services destroys independent deployment and scalability (creating a "distributed monolith"). Statement D is incorrect. Conclusion: The correct statements are **A and C**.
Problem 2
In software engineering, fundamental data structures dictate algorithmic memory layouts, access patterns, and asymptotic efficiencies. Match each data structure to its defining operational characteristic.
Show the solution
**Step 1: Analyze Stack Data Structure** A stack operates strictly on the Last-In, First-Out (LIFO) principle, where push and pop operations occur at the top of the stack. $$\implies \text{LIFO (Last-In, First-Out) discipline with push and pop at a single end}$$ **Step 2: Analyze Queue Data Structure** A queue operates on the First-In, First-Out (FIFO) principle, enqueuing items at the rear/tail and dequeuing from the front/head. $$\implies \text{FIFO (First-In, First-Out) discipline with enqueue at tail and dequeue at head}$$ **Step 3: Analyze Binary Search Tree (BST)** In a BST, every left subtree holds keys smaller than the node, and every right subtree holds keys larger than the node. An in-order depth-first traversal (Left, Root, Right) produces sorted ascending order. $$\implies \text{In-order traversal visits all stored keys in strictly ascending sorted order}$$ **Step 4: Analyze Hash Table** A hash table maps arbitrary keys to bucket indices using a hash function. Under simple uniform hashing and load factor control, average lookup, insert, and delete take $O(1)$ expected time. $$\implies \text{O(1) expected time for key insertion, deletion, and lookup via hash mapping}$$ Conclusion: Matched pairs associate each fundamental data structure with its defining paradigm.
Problem 3
Match each classical software architecture pattern to its defining design topology and communication model.
Show the solution
**Step 1: Understand Classical Software Architectural Patterns** From the FE Reference Handbook (Software Engineering / Architectural Styles): 1. **Client-Server Architecture**: Partitioning tasks between service requesters (clients) and centralized service providers (servers) communicating over a network protocol. 2. **Microservices Architecture**: An architectural style that structures an application as a collection of loosely coupled, independently deployable services communicating via lightweight mechanisms (e.g., HTTP REST APIs, gRPC). 3. **Event-Driven Architecture**: A distributed asynchronous architecture where decoupled software components communicate by producing, detecting, and consuming event messages through an event broker or message queue. 4. **Pipe and Filter Architecture**: A processing architecture consisting of modular processing steps (filters) connected by communication channels (pipes), where the output of each filter serves as the input to the next filter without maintaining shared state. **Step 2: Identify Distractors** - *"Monolithic single-process binary deployed on bare-metal firmware without operating system kernel abstraction"* describes bare-metal embedded firmware, not an architectural pattern. - *"Synchronous polling loop repeatedly querying serial peripheral registers at deterministic hard real-time clock interrupts"* describes a polling I/O driver loop, not an architectural pattern.