0
0
LLDsystem_design~20 mins

Class diagrams in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Class Diagram Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identify the correct relationship type in a class diagram

In a class diagram, which relationship best represents a 'Car' class having an 'Engine' class as a part of it, where the engine cannot exist without the car?

AComposition
BAssociation
CAggregation
DInheritance
Attempts:
2 left
💡 Hint

Think about whether the 'Engine' can exist independently of the 'Car'.

Architecture
intermediate
2:00remaining
Determine the correct multiplicity in a class diagram

A 'Library' class contains multiple 'Book' objects. Which multiplicity notation correctly represents this in a class diagram?

ALibrary 1 ----- * Book
BLibrary 1 ----- 1 Book
CLibrary * ----- 1 Book
DLibrary 0..1 ----- 0..1 Book
Attempts:
2 left
💡 Hint

Consider how many books a library can have.

scaling
advanced
3:00remaining
Choose the best class diagram design for a scalable user management system

You need to design a user management system that supports different user roles with specific permissions. Which class diagram design is best for scalability?

ASeparate classes for each user role inheriting from User class with hardcoded permissions
BUser class with a single string attribute listing all permissions
CUser class with Role class and Permission class linked via associations
DSingle User class with many boolean attributes for each permission
Attempts:
2 left
💡 Hint

Think about flexibility and ease of adding new roles or permissions.

tradeoff
advanced
3:00remaining
Tradeoff between inheritance and composition in class diagrams

Which statement best describes a tradeoff when choosing inheritance over composition in class diagrams?

AInheritance offers more flexibility to change behavior at runtime than composition
BComposition leads to tighter coupling between classes than inheritance
CComposition requires more code duplication than inheritance
DInheritance can cause rigid hierarchies making future changes harder compared to composition
Attempts:
2 left
💡 Hint

Consider how easy it is to modify or extend behavior later.

estimation
expert
4:00remaining
Estimate the number of classes in a class diagram for an online shopping system

For an online shopping system with features: user accounts, product catalog, shopping cart, order processing, payment, and reviews, estimate the minimum number of distinct classes needed in a well-designed class diagram.

AAround 5 classes
BAround 10 classes
CAround 20 classes
DMore than 30 classes
Attempts:
2 left
💡 Hint

Think about main entities and supporting classes for each feature.