Why is composition often preferred over inheritance?
It reduces tight coupling.
Composition is preferred over inheritance because it promotes flexibility and loose coupling. It allows objects to reuse behavior dynamically without rigid class hierarchies. This makes systems easier to extend and maintain.
What does the Open/Closed Principle state?
Open for extension, closed for modification
It states that software entities (classes, modules, functions) should be open for extension but closed for modification. You can add new functionality without changing existing code. This helps maintain stability and reduces the risk of introducing bugs.
What architectural style is based on independent deployable services?
Microservices
It structures an application as a collection of small, independent services. Each service can be developed, deployed, and scaled independently.
What type of pattern is Singleton?
Creational
It ensures that a class has only one instance and provides a global point of access. This is useful for managing shared resources like configuration or logging.
What pattern is used in chat applications like Messenger to push real-time updates to users?
Observer or Publish-Subscribe pattern
It allows the server (subject) to notify multiple clients (observers) of updates in real time. This enables features like live chat messages and notifications.
In OO design, what term describes modeling real-world entities and their interactions in software?
Abstraction
It focuses on representing real-world entities by capturing only their essential attributes and behaviors.
This simplifies complex systems while maintaining relevant details for software design.
What principle advises keeping design simple to reduce risk?
KISS (Keep It Simple, Stupid)
It advises designing systems as simple as possible.
Simple designs reduce complexity, errors, and maintenance risk.
What document records rationale behind key design choices?
Architecture decision record (ADR)
It documents the reasoning, trade-offs, and decisions for key design choices. This helps teams understand and maintain the system over time.
Which pattern lets one object notify others automatically?
Observer
It allows one object (the subject) to notify multiple dependent objects (observers) automatically when its state changes. This supports loose coupling and dynamic relationships between components.
What streaming protocol is widely used by Netflix and YouTube for adaptive video delivery?
HTTP Live Streaming (HLS)
It delivers video in small chunks over HTTP, allowing adaptive bitrate streaming. This ensures smooth playback across varying network conditions.
What is achieved when different classes respond differently to the same method call?
Polymorphism
It allows different classes to define their own behavior for the same method signature.
This enables flexible and extensible code through dynamic method binding.
What principle ensures each test case verifies one specific requirement or behavior?
Single responsibility in testing
Each test case focuses on verifying one specific requirement or behavior. This makes tests easier to understand, maintain, and debug.
Which architectural pattern emphasizes central data flow with unidirectional dependencies?
Pipe-and-Filter Architecture
Data flows in one direction through a sequence of processing components (filters). Each filter transforms the data and passes it to the next, ensuring modularity and clear dependencies.
Which pattern lets you choose algorithms at runtime?
Strategy
It defines a family of algorithms and lets the client choose one at runtime. This enables flexible and interchangeable behavior without modifying the context.
What protocol is commonly used for transmitting patient vitals from IoT devices?
MQTT (Message Queuing Telemetry Transport)
It is lightweight publish-subscribe messaging protocol optimized for low-bandwidth, high-latency networks. It enables reliable, real-time transmission of patient vitals from IoT medical devices.
In UML, what diagram shows how objects collaborate at runtime to achieve a specific function?
Sequence Diagram
It shows how objects interact over time through message exchanges. It emphasizes the order and flow of operations during runtime.
What principle helps prevent ripple effects when code changes occur?
Low coupling
It ensures classes or modules depend minimally on each other. This reduces ripple effects when changes are made, making the system easier to maintain.
Which pattern helps achieve real-time data processing by reacting to events rather than requests?
Event-Driven Architecture
Components react to events as they occur instead of waiting for requests. This enables real-time processing and decoupled, responsive systems.
What test automation design pattern separates the test logic from the UI structure for maintainability?
Page Object Model
It separates test scripts (logic) from the UI elements and structure. This improves maintainability and reduces duplication in automated tests.
What architecture do modern connected medical devices use to integrate with hospital EMR systems?
Service-oriented architecture (SOA)
They expose standardized services and APIs to communicate with hospital EMR systems. This enables interoperability, scalability, and secure data exchange across systems.
What is the key difference between aggregation and composition?
Composition implies ownership; aggregation does not.
Composition: A Car composes its Engine. If the car is destroyed, the engine is also destroyed — strong ownership.
Aggregation: A Car aggregates Passengers. Passengers exist independently of the car — weak ownership, no strict lifecycle dependency.
What design principle is violated when a single change requires modifications in multiple modules?
High coupling or Single Responsibility
A single change in one module can require changes in many others, increasing maintenance effort and risk of bugs. Low coupling is preferred to make systems more modular and easier to maintain.
Which pattern is used in high-performance systems to separate read and write operations?
CQRS (Command Query Responsibility Segregation)
It separates read operations (queries) from write operations (commands). This improves performance, scalability, and simplifies complex system behavior.
What pattern supports executing a series of test actions as a reusable workflow?
Command Pattern
It encapsulates test actions as objects that can be executed, queued, or reused. This enables building reusable and flexible test workflows in automation frameworks.
Which pattern enables undo/redo functionality in applications like text editors?
Memento
It captures and stores an object’s state so it can be restored later. This enables undo and redo functionality in applications like text editors.