Which of the following class designs violates the Single Responsibility Principle (SRP)?
SRP means a class should have only one reason to change.
Option A mixes authentication and logging, which are two different responsibilities. This violates SRP.
You have a payment processing system that requires modifying existing classes to add new payment methods. Which design change best fixes this Open/Closed Principle (OCP) violation?
OCP means software entities should be open for extension but closed for modification.
Option C allows adding new payment methods without changing existing code, following OCP.
Consider a class hierarchy where a subclass overrides a method but throws exceptions not expected by the base class. What problem does this cause in a large system?
Liskov Substitution Principle requires subclasses to be replaceable without altering correctness.
Throwing unexpected exceptions breaks substitutability, causing runtime errors.
Which option best describes a tradeoff when applying Interface Segregation Principle (ISP) strictly in a system with many small interfaces?
ISP encourages small, client-specific interfaces.
While ISP improves modularity, too many small interfaces can increase dependency management complexity.
A system tightly couples high-level modules directly to low-level modules without abstractions. What is the most significant impact on system maintainability and scalability?
Dependency Inversion Principle promotes depending on abstractions, not concretions.
Tight coupling causes ripple effects of changes, making maintenance and scaling harder.