0
0
LLDsystem_design~10 mins

Room type hierarchy 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 base class for all room types.

LLD
class [1]:
    def __init__(self, room_number):
        self.room_number = room_number
Drag options to blanks, or click blank then click option'
ARoom
BRoomType
CBaseRoom
DRoomBase
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural names like Rooms
Using unrelated names like Building
2fill in blank
medium

Complete the code to define a subclass for a conference room inheriting from the base room.

LLD
class ConferenceRoom([1]):
    def __init__(self, room_number, capacity):
        super().__init__(room_number)
        self.capacity = capacity
Drag options to blanks, or click blank then click option'
ARoom
BRoomType
CBaseRoom
DBuilding
Attempts:
3 left
💡 Hint
Common Mistakes
Inheriting from unrelated classes
Forgetting to call super().__init__
3fill in blank
hard

Fix the error in the method overriding to return the room type name.

LLD
class MeetingRoom(Room):
    def get_type(self):
        return [1]
Drag options to blanks, or click blank then click option'
Aself.MeetingRoom
BMeetingRoom
C'MeetingRoom'
Dget_type
Attempts:
3 left
💡 Hint
Common Mistakes
Returning the class name without quotes
Returning a method name instead of a string
4fill in blank
hard

Fill both blanks to create a dictionary comprehension mapping room numbers to their types for rooms with capacity over 10.

LLD
room_types = {room.room_number: room.get_type() for room in rooms if room.[1] > [2]
Drag options to blanks, or click blank then click option'
Acapacity
Bsize
C10
D15
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names
Using incorrect threshold values
5fill in blank
hard

Fill all three blanks to create a list comprehension of room numbers for rooms that are either ConferenceRoom or MeetingRoom.

LLD
selected_rooms = [room.[1] for room in rooms if isinstance(room, [2]) or isinstance(room, [3])]
Drag options to blanks, or click blank then click option'
Aroom_number
BConferenceRoom
CMeetingRoom
DRoom
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names
Checking against the base Room class instead of subclasses