0
0
LLDsystem_design~20 mins

SOLID violations and fixes in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SOLID Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identifying Single Responsibility Principle Violation

Which of the following class designs violates the Single Responsibility Principle (SRP)?

AA class that handles both user authentication and logging user activities.
BA class that only manages user profile data.
CA class dedicated solely to sending email notifications.
DA class that only formats data for display.
Attempts:
2 left
💡 Hint

SRP means a class should have only one reason to change.

Architecture
intermediate
2:00remaining
Fixing Open/Closed Principle Violation

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?

AUse global variables to switch payment methods inside the existing class.
BAdd new methods directly to the existing payment processing class.
CCreate a PaymentMethod interface and implement new payment methods as separate classes.
DDuplicate the payment processing class for each new payment method.
Attempts:
2 left
💡 Hint

OCP means software entities should be open for extension but closed for modification.

scaling
advanced
2:00remaining
Liskov Substitution Principle Violation Impact

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?

AIt breaks Liskov Substitution Principle, causing unexpected runtime errors when using polymorphism.
BIt improves performance by handling errors locally.
CIt simplifies the base class by moving complexity to subclasses.
DIt ensures better encapsulation and hides implementation details.
Attempts:
2 left
💡 Hint

Liskov Substitution Principle requires subclasses to be replaceable without altering correctness.

tradeoff
advanced
2:00remaining
Interface Segregation Principle Tradeoff

Which option best describes a tradeoff when applying Interface Segregation Principle (ISP) strictly in a system with many small interfaces?

AIt decreases modularity by merging multiple responsibilities.
BIncreased number of interfaces can lead to complexity in managing dependencies.
CIt reduces code readability by combining unrelated methods.
DIt forces all clients to implement large interfaces even if they use few methods.
Attempts:
2 left
💡 Hint

ISP encourages small, client-specific interfaces.

estimation
expert
3:00remaining
Estimating Impact of Dependency Inversion Principle Violation

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?

AIt allows easier replacement of low-level modules without affecting high-level modules.
BIt improves performance by avoiding abstraction overhead.
CIt simplifies testing by reducing the number of interfaces.
DChanges in low-level modules require changes in high-level modules, increasing maintenance effort.
Attempts:
2 left
💡 Hint

Dependency Inversion Principle promotes depending on abstractions, not concretions.