51 questions pulled from past papers whose wording matches this week's topics, newest first, duplicates removed. Pick your answers, then press Check answers. Figures and answer keys are the originals.
A news platform wants to send a morning digest email to all subscribers every day at 7 AM. Sweta sets up the beat schedule, starts Redis and Celery Beat, and then claims: "The Worker is optional here. Beat handles the scheduling and the execution of the task, so we do not need a separate Worker process." Is Sweta's claim correct? Choose the best answer.
Yes. For tasks defined in , Celery Beat manages both the schedule and the execution, so running the Worker is redundant.text
```
beat_schedule
```
No. Celery Beat cannot trigger tasks that involve database queries or email sending. Those tasks must be triggered manually using from the Flask app.text
```
.delay()
```
No. Celery Beat is only a scheduler. At 7 AM, it pushes a task message into the Redis broker and stops there. Without a running Celery Worker to pick up that message, the digest email is never actually sent.
Yes, but only when the task is defined with instead of inside .In that case, Beat handles execution too.text
A startup is building a food delivery app. The customer-facing screen shows live order status updates: "Order Placed → Preparing → Out for Delivery → Delivered". Each stage is triggered by the restaurant or the delivery rider updating the status on their end. The customer's screen should reflect these changes in real time without refreshing the page. Two developers debate about the right technology: Developer A says: "Let's use Server-Sent Events. It's the right fit here." Developer B says: "No, we must use WebSockets. SSE won't work." Who is correct, and why?
Developer B is correct. SSE cannot transmit JSON data, so structured order status objects cannot be pushed to the browser.
Developer B is correct. SSE connections do not reconnect automatically when the network is briefly interrupted, making it unreliable for a live tracker.
Developer A is correct, but only if WebSockets are set up as a mandatory fallback, since SSE requires HTTP/2 to function.
Developer A is correct. The tracker only requires the server to push status updates to the customer, without the customer sending data back through the same connection. SSE is purpose-built for exactly this one-way server-to-client push scenario.
In a Celery setup, we use two separate Redis databases:
Which of the following best explains the conceptual difference between the broker and the backend?
A team builds an internal warehouse dashboard where multiple managers, each on a different computer, need to receive live low-stock alerts from the server in real time. They decide to use Flask-SSE with Redis. Which of the following best explains Redis's role in a Flask-SSE setup?
Redis is used by Flask-SSE to authenticate connected users before events can be streamed to the browser.
Redis is optional in Flask-SSE and is only recommended when the application has a very large number of concurrent users.
Redis is only needed when SSE events must be stored permanently and replayed after reconnection.
Flask-SSE uses Redis as a shared event channel so published messages can be delivered to connected clients.
Pratham builds a Flask route that generates a PDF report and sends it to the user via email, all inside the route handler without using Celery. A tester notices that the browser takes about 12 seconds to respond, and during that time other users are unable to use the app normally. Which of the following correctly explain this behaviour and what Celery would change?
Flask handles one request at a time per worker, so the long-running task blocks the entire process until it finishes.
Other users' requests are queued and only served after the heavy task completes, making the app feel unresponsive.
Using Celery's would make the task run faster by giving it more CPU cores.text
```
.delay()
```
With Celery, Flask immediately returns a response to the user while the report generation and email sending happen inside a separate Celery worker process in the background.
You are building a login feature for a web application. The frontend sends the user’s email and password to the backend API. The backend validates credentials against a database. Which security issues exist in the code given below? Frontend: script.js
Backend: app.py
In a web application using webhooks and Redis for real-time data synchronization: Scenario: An order management system where: • When an order is created, a webhook is sent to a notification service • Redis stores the current order cache • Multiple concurrent requests update the cache Which statements about this architecture are true?
Webhooks guarantee that the notification service will process events in the exact order they were triggered
Redis is suitable for this use case because it's an in-memory data structure store that provides fast access to cached data
The webhook will automatically retry if the notification service is temporarily unavailable
Webhooks use HTTP POST requests to communicate events asynchronously
A popular e-commerce platform needs to notify multiple third-party services (inventory management, email marketing, analytics) whenever a customer places an order. The development team is considering different approaches to handle these notifications.
Scenario: When an order is placed, the system needs to:
● Update inventory levels in an external warehouse system ● Send a welcome email through a third-party email service ● Log analytics data to an external tracking service ● Update customer loyalty points in a CRM system
Which of the following statements about using webhooks for this scenario is MOST accurate?
Webhooks are not suitable for this use case because they require the e-commerce platform to continuously poll each third-party service to check if they're ready to receive data, which would create unnecessary network overhead.
Webhooks should be avoided in this scenario because they operatesynchronously, meaning the customer's order placement would be delayed until all third-party services have successfully processed their notifications.
Webhooks provide an ideal solution as they allow the e-commerce platform topush real-time notifications to all subscribed third-party services immediately when an order is placed, eliminating the need for these services to repeatedly poll for updates.
Webhooks are primarily designed for read-only operations and cannot handlecomplex data payloads like order information, making them unsuitable for e-commerce transaction notifications.
Which of the following is true regarding long polling?
Long polling opens multiple connections between the client and the server,and the server continuously sends updates to the client in real-time.
Long polling involves the client repeatedly sending requests at fixed intervalsto the server to check for updates, regardless of whether new data is available.
Long polling allows the client to make a single request to the server, where theserver holds the connection open until new data is available and then sends the response.
Long polling uses WebSockets to maintain a persistent, bidirectionalconnection between the client and the server.
Suppose you are developing an application for millions of users that will perform intensive data analysis and return the results asynchronously. Arrange the following set of actions/operations to achieve an efficient and scalable design.
I. Save the result to a database
II. Invoke a callback URL
III. Queue the analysis job
Which of the following scenarios is an example of a Cross-Site Request Forgery (CSRF) attack?
A user receives an email containing a link to a phishing site that asks for theirlogin credentials.
A user clicks on a malicious link while logged into their bank account, andwithout their knowledge, a money transfer request is sent to the bank's server using the user'sauthenticated session.
A hacker uses a brute-force attack to guess the password of a user's onlineaccount.
A user is tricked into downloading and installing malware that steals theirsensitive information.
Match the following technologies with their typical use cases:
Match the following technologies with their typical use cases:
Text of the picture (copyable)
| | |
|---|---|
| 1. Webhooks | A. Real-time communication in chat applications |
| 2. Web Sockets | B. Fetching data periodically from an API endpoint |
| 3. API | C. Receiving notifications when a specific event occurs |
| 4. Polling | D. Exchanging data between client and server using HTTP requests |
| 5. Pub/Sub | E. Broadcasting messages to multiple subscribers simultaneously |
Consider the following JavaScript code. What will be logged on to the console once the code is executed?
```javascript
const emails = [
'user1@study.iitm.ac.in',
'user2@gmail.com',
'user3@study.iitm.ac.in',
]
const studentsEmail = emails.filter((email) =>
email.endsWith('study.iitm.ac.in')
)
console.log(studentsEmail)
```
Suppose an attacker embeds a malicious link in an email or website, causing the victim's browser to unknowingly submit a form that performs an action (e.g., deleting the user’s account) on the target site where the victim is authenticated. Which type of attack is this?
Suppose you are building an application which requires sending emails to all the users stored in the database at regular intervals. Given below are the two approaches to satisfy the requirement.
Suppose you are building an application which requires sending emails to all the users stored in the database at regular intervals. Given below are the two approaches to satisfy the requirement. Choose the correct statement(s).
Text of the picture (copyable)
Approach 1:
```python
@celery.task
def send_bulk_emails():
all_users = User.query.all() // Get all the user objects from the
database
for user in all_users:
// send email to the user
send_bulk_emails.delay() // invokes celery task
```
Approach 2:
```python
@celery.task
def send_email(email):
// send email to the user
all_users = User.query.all() // Get all the user objects from the database
for user in all_users:
send_email.delay(user.email) // invokes celery task
```
Approach 1 will take more time than approach 2, if more than 2 celery workersare available.
Approach 2 will take more time than approach 1, if more than 2 celery workersare available.
Both the approaches will take same time (approx), if only 1 celery worker isavailable.
Suppose you are writing an application to be used by lakhs of people, which will run a brute force algorithm and gives back the result to the user of the application when ready. Considering this context, arrange the below set of actions/operations to achieve a desirable and practical design. I. Invoke the webhook II. Relieve the worker III. Dispatch a backend job