0
0
LLDsystem_design~10 mins

Identifying classes from requirements 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 identify the main class representing a person in the system.

LLD
class [1]:
    def __init__(self, name, age):
        self.name = name
        self.age = age
Drag options to blanks, or click blank then click option'
AOrder
BCar
CPerson
DProduct
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unrelated class names like Car or Product.
2fill in blank
medium

Complete the code to add an attribute representing a unique identifier for the class.

LLD
class Order:
    def __init__(self, [1], amount):
        self.order_id = [1]
        self.amount = amount
Drag options to blanks, or click blank then click option'
Aprice
Border_id
Cquantity
Dcustomer
Attempts:
3 left
💡 Hint
Common Mistakes
Using attributes like price or quantity as identifiers.
3fill in blank
hard

Fix the error in the class definition by choosing the correct method name for initialization.

LLD
class Product:
    def [1](self, name, price):
        self.name = name
        self.price = price
Drag options to blanks, or click blank then click option'
A__init__
B__start__
C__create__
D__new__
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names like __start__ or __create__.
4fill in blank
hard

Fill both blanks to define a class with an attribute and a method to display it.

LLD
class [1]:
    def __init__(self, [2]):
        self.[2] = [2]
    def display(self):
        print(self.[2])
Drag options to blanks, or click blank then click option'
ACustomer
Bemail
CProduct
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing class names and attribute names incorrectly.
5fill in blank
hard

Fill all three blanks to create a class with an attribute, a method to update it, and a method to retrieve it.

LLD
class [1]:
    def __init__(self, [2]):
        self.[2] = [2]
    def update_[2](self, new_value):
        self.[2] = new_value
    def get_[2](self):
        return self.[2]
Drag options to blanks, or click blank then click option'
AAccount
Bbalance
Cemail
DCustomer
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing class and attribute names or using unrelated attributes.