0
0
LLDsystem_design~20 mins

Bridge pattern in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bridge Pattern Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding the purpose of the Bridge pattern

Which of the following best describes the main purpose of the Bridge pattern in software design?

ATo combine multiple interfaces into a single interface
BTo provide a simplified interface to a complex subsystem
CTo restrict object creation to a single instance
DTo separate an abstraction from its implementation so they can vary independently
Attempts:
2 left
💡 Hint

Think about how the Bridge pattern helps manage changes in code.

Architecture
intermediate
1:30remaining
Identifying components in a Bridge pattern diagram

In a Bridge pattern architecture, which two components are connected by the bridge?

AAbstraction and Implementor
BClient and ConcreteImplementor
CAbstraction and Client
DConcreteAbstraction and ConcreteImplementor
Attempts:
2 left
💡 Hint

One component defines the interface, the other provides the implementation.

scaling
advanced
2:00remaining
Scaling a system using the Bridge pattern

You have a graphics rendering system with multiple shapes and multiple rendering APIs. How does the Bridge pattern help scale this system?

ABy enforcing a strict one-to-one mapping between shapes and rendering APIs
BBy allowing shapes and rendering APIs to be extended independently without modifying existing code
CBy duplicating code for each shape and rendering API combination
DBy merging all shapes and rendering APIs into a single class to reduce complexity
Attempts:
2 left
💡 Hint

Consider how independent extension helps when adding new shapes or APIs.

tradeoff
advanced
1:30remaining
Tradeoffs when using the Bridge pattern

What is a common tradeoff when applying the Bridge pattern in system design?

ATight coupling between abstraction and implementation
BReduced flexibility in changing implementations
CIncreased complexity due to more classes and interfaces
DDifficulty in adding new abstractions
Attempts:
2 left
💡 Hint

Think about what happens when you add layers of abstraction.

component
expert
2:00remaining
Request flow in a Bridge pattern implementation

Consider a Bridge pattern where Abstraction calls methods on Implementor. Which sequence correctly describes the request flow when a client calls an operation on the Abstraction?

AClient → Abstraction → Implementor → ConcreteImplementor
BClient → Implementor → Abstraction → ConcreteImplementor
CClient → ConcreteImplementor → Implementor → Abstraction
DClient → ConcreteImplementor → Abstraction → Implementor
Attempts:
2 left
💡 Hint

Remember the Abstraction delegates work to the Implementor.