0
0
LLDsystem_design~10 mins

Why low level design produces clean code in LLD - Test Your Understanding

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

Complete the code to define a class with clear responsibilities.

LLD
class User [1]:
    def __init__(self, name):
        self.name = name
Drag options to blanks, or click blank then click option'
AManager
BEntity
CController
DService
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Controller' or 'Service' for a simple data class.
2fill in blank
medium

Complete the code to add a method that follows single responsibility principle.

LLD
class Calculator:
    def [1](self, a, b):
        return a + b
Drag options to blanks, or click blank then click option'
Aprocess
Bcalculate_sum
Csum
Dadd_numbers
Attempts:
3 left
💡 Hint
Common Mistakes
Using vague method names that do not describe the action.
3fill in blank
hard

Fix the error in the method that violates clean code principles.

LLD
def process_data(data):
    result = []
    for item in data:
        if item > 0:
            result.append(item)
    return [1]
Drag options to blanks, or click blank then click option'
Aresult
Bitem
Cdata
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Returning the wrong variable or None.
4fill in blank
hard

Fill both blanks to create a clean function that separates concerns.

LLD
def [1](data):
    filtered = [x for x in data if x [2] 0]
    return filtered
Drag options to blanks, or click blank then click option'
Afilter_positive
B>
C<
Dprocess_data
Attempts:
3 left
💡 Hint
Common Mistakes
Using vague function names or wrong comparison operators.
5fill in blank
hard

Fill all three blanks to implement a clean class method that modifies state safely.

LLD
class Counter:
    def __init__(self):
        self.count = 0
    def [1](self):
        self.count [2] 1
        return self.[3]
Drag options to blanks, or click blank then click option'
Aincrement
B+=
Ccount
Dadd
Attempts:
3 left
💡 Hint
Common Mistakes
Using unclear method names or incorrect operators.