0
0
LLDsystem_design~10 mins

Bridge pattern 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 declare the abstraction class with a bridge to the implementation.

LLD
class Abstraction:
    def __init__(self, [1]):
        self.implementation = implementation
Drag options to blanks, or click blank then click option'
Aimplementation
Bbridge
Cimpl
Dinterface
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different parameter name that does not match the attribute.
Forgetting to assign the parameter to an attribute.
2fill in blank
medium

Complete the code to define the implementation interface method.

LLD
class Implementation:
    def [1](self):
        pass
Drag options to blanks, or click blank then click option'
Arun
Bimplement
Cexecute
Doperation
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that are too specific or unrelated.
Forgetting to define the method at all.
3fill in blank
hard

Fix the error in the refined abstraction method calling the implementation.

LLD
class RefinedAbstraction(Abstraction):
    def operation(self):
        return self.[1].operation()
Drag options to blanks, or click blank then click option'
Abridge
Bimpl
Cimplementation
Dinterface
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect attribute name that does not exist.
Calling the method on the abstraction itself instead of the implementation.
4fill in blank
hard

Fill both blanks to complete the concrete implementation class and its operation method.

LLD
class ConcreteImplementation[1](Implementation):
    def operation(self):
        return '[2] implementation result'
Drag options to blanks, or click blank then click option'
AA
BB
CConcrete
DSample
Attempts:
3 left
💡 Hint
Common Mistakes
Using a class name that does not match the pattern.
Returning a string that does not describe the implementation.
5fill in blank
hard

Fill all three blanks to create a client code that uses the bridge pattern.

LLD
impl = ConcreteImplementation[1]()
abstraction = RefinedAbstraction([2])
result = abstraction.[3]()
print(result)
Drag options to blanks, or click blank then click option'
AB
Bimpl
Coperation
DA
Attempts:
3 left
💡 Hint
Common Mistakes
Using mismatched implementation suffix and class name.
Passing wrong variable to the abstraction constructor.
Calling a method that does not exist.