0
0
LLDsystem_design~10 mins

Interface Segregation Principle in LLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a small interface for printing only.

LLD
interface Printer {
    void [1]();
}
Drag options to blanks, or click blank then click option'
AcopyDocument
BscanDocument
CfaxDocument
DprintDocument
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing methods related to scanning or faxing instead of printing.
2fill in blank
medium

Complete the code to split a large interface into two smaller ones.

LLD
interface [1] {
    void printDocument();
}
interface [2] {
    void scanDocument();
}
Drag options to blanks, or click blank then click option'
APrinter
BScanner
CFaxMachine
DCopier
Attempts:
3 left
💡 Hint
Common Mistakes
Combining unrelated methods in one interface.
Using incorrect interface names.
3fill in blank
hard

Fix the error in the interface segregation by choosing the correct interface name for faxing.

LLD
interface [1] {
    void faxDocument();
}
Drag options to blanks, or click blank then click option'
AScanner
BPrinter
CFaxMachine
DCopier
Attempts:
3 left
💡 Hint
Common Mistakes
Putting fax method in Printer or Scanner interfaces.
4fill in blank
hard

Fill both blanks to define interfaces for printing and scanning separately.

LLD
interface [1] {
    void printDocument();
}
interface [2] {
    void scanDocument();
}
Drag options to blanks, or click blank then click option'
APrinter
BScanner
CFaxMachine
DCopier
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same interface for both printing and scanning.
5fill in blank
hard

Fill all three blanks to define a multi-function device implementing separate interfaces.

LLD
class MultiFunctionDevice implements [1], [2], [3] {
    public void printDocument() { /* implementation */ }
    public void scanDocument() { /* implementation */ }
    public void faxDocument() { /* implementation */ }
}
Drag options to blanks, or click blank then click option'
APrinter
BScanner
CFaxMachine
DCopier
Attempts:
3 left
💡 Hint
Common Mistakes
Implementing a single large interface instead of multiple small ones.