MAD Study Hub

Home / MAD2 / Week 10 / Real questions

MAD2 week 10 - real exam questions

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.

Elapsed 00:00
MAD2 End Term · 13 Sep 2026 · open the full paper
Practice 1MCQ4.5 marks
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.
  1. Yes. For tasks defined in , Celery Beat manages both the schedule and the execution, so running the Worker is redundant.
    text
    ```
    beat_schedule
    ```
  2. 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()
    ```
  3. 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.
  4. Yes, but only when the task is defined with instead of inside .In that case, Beat handles execution too.
    text
    ```
    .apply_async()
    ```
    ```
    beat_schedule
    ```
MAD2 End Term · 13 Sep 2026 · open the full paper
Practice 2MCQ4.5 marks
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?
  1. Developer B is correct. SSE cannot transmit JSON data, so structured order status objects cannot be pushed to the browser.
  2. Developer B is correct. SSE connections do not reconnect automatically when the network is briefly interrupted, making it unreliable for a live tracker.
  3. Developer A is correct, but only if WebSockets are set up as a mandatory fallback, since SSE requires HTTP/2 to function.
  4. 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.
MAD2 End Term · 13 Sep 2026 · open the full paper
Practice 3MCQ4.5 marks
In a Celery setup, we use two separate Redis databases: question figure Which of the following best explains the conceptual difference between the broker and the backend?
Text of the picture (copyable)
```python
celery_app = Celery(
    'tasks',
    broker='redis://localhost:6379/1',
    backend='redis://localhost:6379/2',
    include=['tasks']
)
```
  1. The backend is only needed when tasks involve sending emails; for tasks that only read from the database, only the broker is required.
  2. The broker and backend must always use different port numbers; using the same Redis port for both would cause a conflict.
  3. The broker distributes tasks evenly across multiple Celery workers, while the backend tracks which worker is currently processing which task.
  4. The broker stores task requests until a Celery worker picks and executes them, while the backend stores the task result after execution.
MAD2 End Term · 13 Sep 2026 · open the full paper
Practice 4MCQ3 marks
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?
  1. Redis is used by Flask-SSE to authenticate connected users before events can be streamed to the browser.
  2. Redis is optional in Flask-SSE and is only recommended when the application has a very large number of concurrent users.
  3. Redis is only needed when SSE events must be stored permanently and replayed after reconnection.
  4. Flask-SSE uses Redis as a shared event channel so published messages can be delivered to connected clients.
MAD2 End Term · 13 Sep 2026 · open the full paper
Practice 5MSQ3 marksselect all that apply
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?
  1. Flask handles one request at a time per worker, so the long-running task blocks the entire process until it finishes.
  2. Other users' requests are queued and only served after the heavy task completes, making the app feel unresponsive.
  3. Using Celery's would make the task run faster by giving it more CPU cores.
    text
    ```
    .delay()
    ```
  4. 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.
MAD2 End Term · 10 May 2026 · open the full paper
Practice 6MCQ2 marks
Which of the following HTTP methods does WebSocket use for initial handshake?
  1. GET
  2. POST
  3. PUT
  4. DELETE
MAD2 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 7MCQ3 marks
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 question figure Backend: app.py question figure
Text of the picture (copyable)
```javascript
methods: {
  async login() {
    const response = await fetch('/login', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ email: this.email, password: this.password })
    });
    const data = await response.json();
    console.log(data.message);
  }
}
```
```python
@app.route('/login', methods=['POST'])
def login():
    email = request.json['email']
    password = request.json['password']
    query = f"SELECT * FROM users WHERE email = '{email}'" \
            f" AND password = '{password}'"
    result = db.execute(query)
    if result:
        return jsonify({"message": "Login successful"})
    return jsonify({"message": "Invalid credentials"})
```
  1. The SQL query is vulnerable to SQL injection attacks
  2. Passwords are stored and compared in plain text
  3. No authentication token (session/JWT) mechanism is implemented
  4. All of these.
MAD2 End Term · 21 Dec 2025 · open the full paper
Practice 8MSQ2 marksselect all that apply
Which of the following describe Redis features correctly?
  1. In-memory database
  2. Can support publish-subscribe (pub/sub)
  3. Can be used as Celery result backend
  4. Requires SQL to query
MAD2 End Term · 21 Dec 2025 · open the full paper
Practice 9MSQ3 marksselect all that apply
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?
  1. Webhooks guarantee that the notification service will process events in the exact order they were triggered
  2. Redis is suitable for this use case because it's an in-memory data structure store that provides fast access to cached data
  3. The webhook will automatically retry if the notification service is temporarily unavailable
  4. Webhooks use HTTP POST requests to communicate events asynchronously
MAD2 End Term · 31 Aug 2025 · open the full paper
Practice 10MCQ2 marks
In a message queue system, if the consumer is slower than the producer, what is likely to occur first?
  1. Messages will be dropped
  2. Messages will accumulate in the queue
  3. The consumer will speed up automatically
  4. The producer will block until the consumer is ready
MAD2 End Term · 31 Aug 2025 · open the full paper
Practice 11MSQ2 marksselect all that apply
Which statements about webhooks are correct?
  1. They enable real-time data delivery
  2. They use HTTP POST requests typically
  3. They're designed for server-to-server communication
  4. They require polling from the client
MAD2 End Term · 31 Aug 2025 · open the full paper
Practice 12MCQ3 marks
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?
  1. 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.
  2. 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.
  3. 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.
  4. Webhooks are primarily designed for read-only operations and cannot handlecomplex data payloads like order information, making them unsuitable for e-commerce transaction notifications.
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 13MCQ2 marks
Which of the following is a key difference between Web Sockets and Server-Sent Events (SSE)?
  1. SSE allows bidirectional communication, while WebSockets only allow server-to-client communication.
  2. WebSockets maintain a persistent connection, while SSE creates a newconnection for each message.
  3. SSE works over HTTP and only supports server-to-client communication,whereas WebSockets provide full-duplex communication.
  4. WebSockets require an HTTP request for every message sent.
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 14MCQ2 marks
Which HTTP method is typically used for sending webhook notifications?
  1. GET
  2. POST
  3. DELETE
  4. PATCH
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 15MCQ2 marks
Which of the following HTTP methods does SSE use for streaming updates to clients?
  1. GET
  2. POST
  3. PUT
  4. PATCH
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 16MCQ2 marks
How does a webhook differ from an API call?
  1. A webhook is triggered by an event, while an API call requires a client request.
  2. A webhook always returns a response body, while an API call does not.
  3. A webhook uses WebSockets for communication, while APIs use REST.
  4. A webhook only supports the HTTP GET method.
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 17MCQ3 marks
Which scenario is best suited for a task queue system like Celery or RabbitMQ?
  1. A real-time chat application that requires low-latency message delivery.
  2. A weather API that provides instant weather data upon request.
  3. A system where a webhook sends an immediate notification to a client whenan event occurs.
  4. A system where a user uploads a video, and it needs to be processedasynchronously.
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 18MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the below flask SSE implementation.

```python
from flask import Flask, Response
import time

app = Flask(__name__)

def event_stream():
    for i in range(5):
        yield f"data: Message {i}"
        time.sleep(1)

@app.route('/events')
def sse():
    return Response(event_stream(), mimetype="text/event-stream")
```

And the Vue.js frontend:

```html
<template>
  <div>
    <p v-for="msg in messages" :key="msg">{{ msg }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return { messages: [] };
  },
  mounted() {
    const eventSource = new EventSource("http://localhost:5000/events");
    eventSource.onmessage = (event) => {
      this.messages.push(event.data);
    };
  },
};
</script>
```

What will happen when a user opens this page?
  1. The client will receive 5 messages, one per second.
  2. The client will receive all 5 messages instantly.
  3. The client will not receive any messages due to CORS issues.
  4. The server will crash because Flask cannot handle SSE.
MAD2 End Term · 13 Apr 2025 · open the full paper
Practice 19MSQ3 marksselect all that apply
In an SSE connection, how does the client handle incoming messages?
  1. The client polls the server at regular intervals.
  2. The client listens to a WebSocket stream.
  3. The client registers an “onmessage” event listener on the EventSource object.
  4. The client sends a POST request for each new event.
MAD2 Quiz 2 · 16 Mar 2025 · open the full paper
Practice 20MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the below Vue.js application.

```html
<template>
  <div>
    <input v-model="name" placeholder="Enter name">
    <input v-model="email" placeholder="Enter email">
    <button @click="submitForm">Submit</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: '',
      email: ''
    };
  },
  mounted() {
    if (localStorage.getItem('formData')) {
      const savedData = JSON.parse(localStorage.getItem('formData'));
      this.name = savedData.name;
      this.email = savedData.email;
    }
  },
  watch: {
    name(newVal) {
      localStorage.setItem('formData', JSON.stringify({ name: newVal, email: localStorage.email }));
    },
    email(newVal) {
      localStorage.setItem('formData', JSON.stringify({ name: localStorage.name, email: newVal }));
    }
  },
  methods: {
    submitForm() {
      localStorage.removeItem('formData');
      this.name = '';
      this.email = '';
    }
  }
};
</script>
```

What will happen if the user submits the form and reloads the page?
  1. The form data will persist in the input fields even after submission and pagereload.
  2. The form data will be cleared after submission, and no data will appear after apage reload.
  3. The form data will appear in the inputs after submission and page reload, butonly until the user starts typing again.
  4. The page will go blank.
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 21MCQ3 marks
Which of the following is true regarding long polling?
  1. Long polling opens multiple connections between the client and the server,and the server continuously sends updates to the client in real-time.
  2. Long polling involves the client repeatedly sending requests at fixed intervalsto the server to check for updates, regardless of whether new data is available.
  3. 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.
  4. Long polling uses WebSockets to maintain a persistent, bidirectionalconnection between the client and the server.
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 22MCQ3 marks
question figure
Text of the picture (copyable)
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
  1. II, III, I
  2. III, I, II
  3. III, II, I
  4. I, II, III
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 23MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following html with appropriate vue 2 cdn link attached.

```html
<div id="app"></div>
<script>
  new Vue({
    el: '#app',
    template: `
      <div>
        <form @submit.prevent>
          <input v-model="email" @input="validateEmail">
          <button type="submit">Submit</button>
          <p>Errors: {{ displayErrors.join(', ') }}</p>
        </form>
      </div>
    `,
    data() {
      return {
        email: '',
        errors: [],
        validating: false,
        existingEmails: ['test@test.com', 'example@example.com']
      };
    },
    computed: {
      displayErrors() {
        return this.validating ? ['Validating...'] :
          this.errors;
      }
    },
    methods: {
      validateEmail() {
        this.validating = true;
        this.errors = [];

        if (!this.email.includes('@')) {
          this.errors.push('@ not present');
        }
        if (!this.email.includes('.')) {
          this.errors.push('invalid format');
        }

        if (this.existingEmails.includes(this.email)) {
          this.errors.push('Email exists');
        }

        this.validating = false;
      }
    },
    watch: {
      email(value) {
        if (!value) this.errors = ['Required']
      }
    }
  });
</script>
```

When typing "test@test.com" and then deleting it all, what is shown in the "Errors" paragraph at the end?
  1. Required
  2. Invalid format, Email exists, Required
  3. Required, Email exists
  4. Validating..., Required
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 24MSQ3 marksselect all that apply
Which of the following statements correctly describe the use of asynchronous messaging systems and frameworks?
  1. Celery allows web servers to offload long-running tasks to worker processes,decoupling task execution from user requests.
  2. Push queues are used for real-time operations, while pull queues are bettersuited for batch processing.
  3. Server-Sent Events (SSE) provide a persistent connection between server andclient, enabling bi-directional communication.
  4. Redis is a high-performance in-memory database that supports Pub/Sub.
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 25MSQ3 marksselect all that apply
Which of the following statement(s) is/are true about Webhooks?
  1. A Webhook is a method for a server to send real-time data to another serveras an HTTP POST request.
  2. Webhooks are typically used for sending periodic updates at regular intervals.
  3. A client must continuously poll a Webhook URL to receive data.
  4. Webhooks are usually used in event-driven architectures, where an eventtriggers an HTTP POST request to a specified endpoint.
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 26MSQ3 marksselect all that apply
Which of the following statement(s) is/are true regarding Server-Sent Events (SSE) and WebSockets?
  1. SSE is a two-way communication protocol, while WebSockets areunidirectional.
  2. WebSockets are more suited for scenarios requiring bi-directionalcommunication.
  3. SSE is based on HTTP and can only be used for server-to-client communication,while WebSockets are based on TCP and support both directions.
  4. SSE is an extension of WebSockets, providing enhanced support for server-to-client communication.
MAD2 End Term · 22 Dec 2024 · open the full paper
Practice 27MSQ3 marksselect all that apply
Which of the following is/are typical use case(s) for Celery tasks?
  1. Processing time-consuming or resource-intensive background jobsasynchronously.
  2. Directly handling incoming HTTP requests in web servers.
  3. Scheduling periodic tasks like sending emails or cleaning up the database.
  4. Serving real-time notifications over WebSockets.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 28MCQ3 marks
Which of the following scenarios is an example of a Cross-Site Request Forgery (CSRF) attack?
  1. A user receives an email containing a link to a phishing site that asks for theirlogin credentials.
  2. 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.
  3. A hacker uses a brute-force attack to guess the password of a user's onlineaccount.
  4. A user is tricked into downloading and installing malware that steals theirsensitive information.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 29MCQ3 marks
Match the following technologies with their typical use cases: question figure 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 |
  1. 1 - C, 2 - A, 3 - D, 4 - B, 5 - E
  2. 1 - D, 2 - E, 3 - A, 4 - C, 5 - B
  3. 1 - C, 2 - C, 3 - E, 4 - A, 5 - D
  4. 1 - D, 2 - A, 3 - C, 4 - D, 5 - B
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 30MSQ3 marksselect all that apply
Which of the following scenarios are best suited for using Celery tasks?
  1. Handling real-time user interactions on a website.
  2. Sending out periodic email notifications to users.
  3. Generating and displaying dynamic content on a web page.
  4. Performing long-running data processing tasks in the background.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 31MSQ3 marksselect all that apply
Which of the following statements is/are true regarding webhooks and server sent events (SSE)?
  1. Webhooks are typically used for server-to-server communication, while SSE isused for server-to-client communication.
  2. Webhooks require the client to maintain an open connection to receiveupdates, while SSE does not.
  3. Webhooks are initiated by the server, while SSE connections are initiated bythe client.
  4. SSE supports bidirectional communication, whereas webhooks do not.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 32MSQ2 marksselect all that apply
Which of the following is/are true about Server-Sent Events (SSE)?
  1. SSE connections are established using HTTP.
  2. SSE supports bidirectional communication between client and server.
  3. SSE automatically switches to web socket if the connection is successful.
  4. SSE is suitable for sending updates to multiple clients simultaneously.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 33MSQ2 marksselect all that apply
Which of the following statement(s) is/are true regarding long and short polling?
  1. A webhook is the same as short polling.
  2. The short polling can be used to know the state of an asynchronous task, andtrigger an action if the task gets completed.
  3. The long polling cannot be achieved using HTTP protocol.
  4. Long Polling can be used to achieve real time communication.
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 34MCQ3 marks
Comprehension passage for this question
Options: question figure Options: question figure Options: Based on the above data, answer the given subquestions. question figure
Which code snippet represents a Webhook receiver implementation?
  1. A
  2. B
  3. C
  4. D
MAD2 End Term · 01 Sep 2024 · open the full paper
Practice 35MCQ2 marks
Comprehension passage for this question
Options: question figure Options: question figure Options: Based on the above data, answer the given subquestions. question figure
Which code snippet represents a Pub/Sub implementation?
  1. A
  2. B
  3. C
  4. D
MAD2 End Term · 28 Apr 2024 · open the full paper
Practice 36MCQ3 marks
What is the primary advantage of using server-sent events over traditional polling?
  1. Server-sent events support bidirectional communication.
  2. Server-sent events can handle larger payloads.
  3. Server-sent events reduce server load by eliminating the need for frequentpolling.
  4. Server-sent events provide lower latency compared to polling.
MAD2 End Term · 28 Apr 2024 · open the full paper
Practice 37MCQ3 marks
Which of the following protocols is commonly used for implementing polling?
  1. HTTP
  2. Web Sockets
  3. FTP
  4. SMTP
MAD2 Quiz 1 · 25 Feb 2024 · open the full paper
Practice 38MCQ2 marks
question figure
Text of the picture (copyable)
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)
```
  1. question figure
    text
    [ user1@study.iitm.ac.in, user2@gmail.com, user3@study.iitm.ac.in ]
  2. question figure
    text
    [ user1@study.iitm.ac.in, user3@study.iitm.ac.in ]
  3. question figure
    text
    [ user2@gmail.com, user3@study.iitm.ac.in ]
  4. question figure
    text
    [user2@gmail.com]
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 39MSQ2 marksselect all that apply
Which of the following statements is/are correct.
  1. SMTP is a mail delivery protocol.
  2. SMTP is a protocol to retrieve email from an email server.
  3. IMAP is a mail delivery protocol.
  4. IMAP is a protocol to retrieve email from an email server.
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 40MSQ2 marksselect all that apply
Which of the following statement(s) is/are true regarding webhooks?
  1. A webhook uses HTTP protocol.
  2. A webhook uses web socket protocol.
  3. A webhook receiver must be deployed on the same origin as the webhookinitiator.
  4. A webhook is supposed to be used for machine to machine communication.
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 41MSQ3 marksselect all that apply
Which of the following statement(s) is/are false regarding long and short polling?
  1. A webhook is the same as short polling.
  2. The short polling can be used to know the state of an asynchronous task, andtrigger an action if the task gets completed.
  3. The long polling cannot be achieved using HTTP protocol.
  4. Long Polling can be used to achieve real time communication.
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 42MCQ3 marks
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?
  1. Denial Of Service Attack
  2. CSRF Attack
  3. Flooding Attack
  4. None of these
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 43MSQ2 marksselect all that apply
Which of the following statements is/are false.
  1. SMTP is a mail delivery protocol.
  2. SMTP is a protocol to retrieve email from an email server.
  3. IMAP is a mail delivery protocol.
  4. IMAP is a protocol to retrieve email from an email server.
MAD2 End Term · 24 Dec 2023 · open the full paper
Practice 44MSQ2 marksselect all that apply
Which of the following statement(s) is/are false regarding webhooks?
  1. A webhook uses HTTP protocol.
  2. A webhook uses web socket protocol.
  3. A webhook receiver must be deployed on the same origin as the webhookinitiator.
  4. A webhook is supposed to be used for machine to machine communication
MAD2 Quiz 1 · 29 Oct 2023 · open the full paper
Practice 45MCQ4.5 marks
Consider the following JavaScript program. question figure Consider the following JavaScript program. What will be logged on to the console?
Text of the picture (copyable)
```javascript
const userDetails = {
  name: 'user1',
  email: 'user1@email.com',
  password: '12345',
}

function user({ userName: name = 'Name1', password }) {
  return `Username: ${name}, Password: ${password}`
}
console.log(user(userDetails))
```
  1. Username: Name1, Password: 12345
  2. Username: user1, Password: 12345
  3. Username: Name1, Password: undefined
  4. Username: user1, Password: undefined
MAD2 Quiz 1 · 29 Oct 2023 · open the full paper
Practice 46MCQ3 marks
Consider the following JavaScript code. question figure Consider the following JavaScript code. What will be logged on to the console?
Text of the picture (copyable)
```javascript
function getName () {
  return this.userName
}

const getEmail = () => this.email

const User1 = { userName: 'Test User1', email: 'user1@email.com' }
const User2 = { userName: 'Test User2', email: 'user2@email.com' }

User1.getName = getName
User2.getEmail = getEmail

console.log(User1.getName())
console.log(User2.getEmail())
```
  1. question figure
    text
    Test User1
    Undefined
  2. question figure
    text
    Test User1
    user2@email.com
  3. question figure
    text
    Test User1
    Test User2
  4. question figure
    text
    Test User2
    user2@email.com
MAD2 End Term · 30 Apr 2023 · open the full paper
Practice 47MSQ2 marksselect all that apply
Which of the following statement(s) is/are false about pub/sub messaging?
  1. Publisher has to know about all the subscribers.
  2. Publisher does not have to know about the subscribers.
  3. Communication between publisher and subscribers is asynchronous.
  4. Communication between publishers and subscribers is synchronous.
MAD2 End Term · 30 Apr 2023 · open the full paper
Practice 48MSQ3 marksselect all that apply
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. question figure 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
```
  1. Approach 1 will take more time than approach 2, if more than 2 celery workersare available.
  2. Approach 2 will take more time than approach 1, if more than 2 celery workersare available.
  3. Both the approaches will take same time (approx), if only 1 celery worker isavailable.
  4. None of these
MAD2 End Term · 30 Apr 2023 · open the full paper
Practice 49MCQ2 marks
Which of the following statements is false regarding webhooks?
  1. A webhook should deliver data to other apps, as it happens.
  2. A webhook is primarily meant for a server to server communication.
  3. A webhook typically uses an HTTP POST request to deliver the response.
  4. A webhook and web socket is essentially the same.
MAD2 End Term · 11 Dec 2022 · open the full paper
Practice 50MCQ2 marks
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
  1. I, III, II
  2. III, I, II
  3. I, II, III
  4. The polling will be a better design.
MAD2 End Term · 07 Aug 2022 · open the full paper
Practice 51MSQ2 marksselect all that apply
Which of the following statement(s) is/are true regarding webhooks and polling?
  1. A webhook uses HTTP protocol.
  2. The term “polling” generally refers to short polling.
  3. Webhooks are used for 1 way communication, unlike web sockets.
  4. In polling, the connection to the server is kept open, until the data is available.