Bird
0
0
LLDsystem_design~10 mins

Notification system 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 define the main component responsible for sending notifications.

LLD
class Notification[1]:
    def send(self, message, user):
        pass
Drag options to blanks, or click blank then click option'
AManager
BHandler
CService
DController
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Controller' which is more related to handling user requests in MVC.
Using 'Manager' which is less common for this purpose.
2fill in blank
medium

Complete the code to add a method that queues notifications for asynchronous processing.

LLD
class NotificationService:
    def [1]_notification(self, message, user):
        # Add notification to queue
        pass
Drag options to blanks, or click blank then click option'
Aqueue
Benqueue
Csend
Dpush
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'send' which implies immediate sending, not queuing.
Using 'push' which is less descriptive in this context.
3fill in blank
hard

Fix the error in the code to correctly process notifications from the queue.

LLD
def process_notifications():
    while not queue.[1]():
        notification = queue.get()
        notification.send()
Drag options to blanks, or click blank then click option'
AisNotEmpty
Bis_empty
Cempty
Dis_empty()
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'empty' which is a property, not a method.
Using 'is_empty' without parentheses, causing syntax error.
4fill in blank
hard

Fill both blanks to define a dictionary comprehension that maps user IDs to their notification counts if count is greater than 5.

LLD
user_notifications = {user_id: count for user_id, count in notifications.items() if count [1] [2]
Drag options to blanks, or click blank then click option'
A>
B5
C<
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' which reverses the condition.
Using 10 instead of 5 which changes the threshold.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps user emails to their last notification timestamp if the timestamp is after 2023-01-01.

LLD
recent_notifications = {user[1]: notif[2] for user, notif in notifications.items() if notif[3] '2023-01-01'}
Drag options to blanks, or click blank then click option'
A.email
B.last_sent
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' which reverses the date filter.
Mixing up user and notification attributes.