Design a Notification System — Concept Check
Questions on Design a Notification System. Build a multi-channel notification system with pluggable channel handlers, template support, retry logic via Chain of Responsibility, and event-driven dispatch.
Questions in this quiz
8 questions on Design a Notification System — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A notification system sends an email but the recipient reports not receiving it. The system logs show that the EmailHandler returned false. What should the system do next?
- ALog the failure and stop further attempts.
- BNotify the user of the failure immediately.
- CSwitch to sending the notification via SMS.
- DRetry sending the email using the RetryChannelHandler.
2.A developer adds a new channel handler for a messaging app. What must they ensure for the system to support this new channel?
- AModify the NotificationService to handle the new channel.
- BImplement the ChannelHandler interface for the new channel.
- CCreate a new retry logic specific to the new channel.
- DUpdate all existing templates to include the new channel.
3.A notification system is designed to send alerts over multiple channels. If the primary channel fails, what is the expected behavior?
- AThe system stops all notification attempts.
- BThe system falls back to the next available channel.
- CThe system sends a failure report to the admin.
- DThe system retries indefinitely on the primary channel.
4.A developer claims that adding a new channel requires changes to the retry logic in each handler. Why is this incorrect?
- ARetry logic is handled by the RetryChannelHandler, not individual handlers.
- BRetry logic is only applicable to email and SMS channels.
- CEach handler must implement its own retry logic.
- DRetry logic is unnecessary for new channels.
5.A notification system uses templates for message content. What advantage does this provide?
- AIt ensures all messages are sent in plain text.
- BIt simplifies the registration of new handlers.
- CIt allows dynamic selection of channels at runtime.
- DIt keeps channel implementations free of business copy.
6.A notification system is set up to send via EMAIL and SMS. If EMAIL fails, what happens next?
- AThe system retries the EMAIL indefinitely.
- BThe system attempts to send via SMS.
- CThe system sends a failure notification to the sender.
- DThe system logs the failure and stops.
7.What is the role of the NotificationTemplate class in the notification system?
- AIt manages the retry logic for failed notifications.
- BIt handles the delivery of notifications to recipients.
- CIt logs the status of each notification sent.
- DIt holds the subject and body template for messages.
8.A developer believes that the Observer pattern in the notification system directly triggers the NotificationService API. Why is this belief incorrect?
- AThe Observer pattern only works with email notifications.
- BThe Observer pattern is not used in notification systems.
- CThe Observer pattern requires manual API calls for triggering.
- DThe Observer pattern triggers notifications from application events without direct API calls.