MAD Study Hub

Home / Past papers / MAD2 End Term / this paper

Modern Application Development Ii 13 Sep 26 (Session 2) - 13 Sep 2026

MAD2 End Term32 questions100 marks25 MCQ · 7 MSQ
Elapsed 00:00
Q1MCQ2 marks
A JWT token contains three parts: . Which of the following best explains the relationship between the header and the signature in JWT authentication?
Text of the picture (copyable)
```
header.payload.signature
```
  1. The header stores the encrypted password used to generate the signature.
  2. The signature only protects the payload section; changes to the header do not affect token validation.
  3. The signature is generated using the encoded header, encoded payload, and a secret key. If the header is modified, the signature verification fails.
  4. The header contains the final signature hash generated after token creation.
Q2MCQ4.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
    ```
Q3MCQ4.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.
Q4MCQ4.5 marks
Consider the following and JavaScript for a Vue application: File: index.html question figure File: app.js question figure Suppose the application is running on , and the user visits the URL: What will be rendered by the browser? [NOTE: is divided in two images, consider them as one file content.] question figure
Text of the picture (copyable)
index.html
app.js
```html
<div id="app">
  <router-view></router-view>
</div>
```
```javascript
const Flights = {
  template: `<h2>{{ result }}</h2>`,

  data() {
    return {
      routes: [
        { city: "Delhi", connectedTo: ["Mumbai", "Pune"] },
        { city: "Indore", connectedTo: ["Bhopal", "Jaipur"] },
        { city: "Raipur", connectedTo: ["Nagpur", "Hyderabad"] },
        { city: "Rewa", connectedTo: ["Delhi", "Indore", "Raipur"] }
      ],
      result: ""
    };
  },

  created() {
    const destination = this.$route.params.city.toLowerCase();

    for (let i = 0; i < this.routes.length; i++) {
      const connections = this.routes[i].connectedTo;

      for (let j = 0; j < connections.length; j++) {
        if (connections[j].toLowerCase() === destination) {
          this.result = this.routes[i].city;
          break;
        }
      }

      if (this.result) {
        break;
      }
    }
  }
};
```
```
http://localhost:8080
```
```
http://localhost:8080/#/raipur
```
app.js
```javascript
const router = new VueRouter({
  routes: [
    {
      path: "/:city",
      component: Flights
    }
  ]
});

new Vue({
  el: "#app",
  router
});
```
  1. Delhi
  2. Indore
  3. Raipur
  4. Rewa
Q5MCQ4.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.
Q6MCQ4.5 marks
Consider the following Vuex store: question figure The getter is used in a Vue component as shown below: question figure Now suppose the Vuex getter is removed, while the temperature state continues to be updated through Vuex mutations. Which of the following implementations correctly recreates in the component so that it automatically reacts whenever the Vuex changes?
Text of the picture (copyable)
```javascript
const store = new Vuex.Store({
  state: {
    temperature: 30
  },
  getters: {
    weatherStatus(state) {
      return state.temperature >= 35 ? "Hot" : "Normal"
    }
  }
})
```
weatherStatus
```javascript
computed: {
  weatherStatus() {
    return this.$store.getters.weatherStatus
  }
}
```
weatherStatus
weatherStatus
temperature
  1. question figure
    text
    ```javascript
    computed: {
      weatherStatus() {
        return this.$store.state.temperature >= 35
          ? "Hot"
          : "Normal"
      }
    }
    ```
  2. question figure
    text
    ```javascript
    watch: {
      weatherStatus() {
        return this.$store.state.temperature >= 35
          ? "Hot"
          : "Normal"
      }
    }
    ```
  3. question figure
    text
    ```javascript
    methods: {
      weatherStatus() {
        this.$store.state.temperature >= 35
          ? "Hot"
          : "Normal"
      }
    }
    ```
  4. question figure
    text
    ```javascript
    watch: {
      weatherStatus() {
        return this.$store.state.temperature >= 35
      }
    }
    ```
Q7MCQ3 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.
Q8MCQ3 marks
Match the testing concept in Column I with the most appropriate description in Column II. question figure
Text of the picture (copyable)
| Column I | Column II |
| :------- | :-------- |
| 1. Unit Testing | A. Testing application behaviour across different browsers |
| 2. E2E Testing | B. Commonly used for writing and running tests |
| 3. Cross-Browser Testing | C. Testing individual Vue components independently |
| 4. Jest / Mocha / Chai | D. Testing a complete application flow including backend interaction |
  1. 1-C, 2-B, 3-A, 4-D
  2. 1-B, 2-C, 3-D, 4-A
  3. 1-A, 2-D, 3-B, 4-C
  4. 1-C, 2-D, 3-A, 4-B
Q9MCQ3 marks
Match the performance metric in Column I with the most appropriate description in Column II. question figure
Text of the picture (copyable)
| Column I | Column II |
|---|---|
| 1. First Contentful Paint (FCP) | A. Measures unexpected movement of page elements |
| 2. Largest Contentful Paint (LCP) | B. Measures how long the page is blocked from responding to user interaction |
| 3. Total Blocking Time (TBT) | C. Measures when something first appears on the screen |
| 4. Cumulative Layout Shift (CLS) | D. Measures when the largest visible content is rendered |
  1. 1-C, 2-D, 3-B, 4-A
  2. 1-B, 2-C, 3-A, 4-D
  3. 1-C, 2-B, 3-D, 4-A
  4. 1-A, 2-B, 3-D, 4-C
Q10MCQ3 marks
A developer has just created a new Vue 2 project using Vue CLI and the following package.json was generated. package.json question figure The developer wants to view the app in the browser locally for development. They run the following command: bash: Which of the following best describes what happens and what the developer should have run instead?
Text of the picture (copyable)
```json
{
  "name": "my-vue-app",
  "version": "0.1.0",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "^2.6.14"
  },
  "devDependencies": {
    "@vue/cli-service": "^5.0.0",
    "babel-eslint": "^10.1.0"
  }
}
```
```
npm run build
```
  1. launches the app on ; the developer should have run npm start to compile for production instead.
    text
    ```
    npm run build
    ```
    ```
    localhost:8080
    ```
  2. and do the same thing — both launch the app at
    text
    ```
    npm run build
    ```
    ```
    npm run serve
    ```
    ```
    localhost:8080
    ```
  3. is correct for local development; is only used for deploying to a server.
    text
    ```
    npm run build
    ```
    ```
    npm run serve
    ```
  4. compiles and bundles the app for production into a folder — it does not start a local server. The developer should have run instead.
    text
    ```
    npm run build
    ```
    /dist
    ```
    npm run serve
    ```
Q11MCQ3 marks
Consider the following JavaScript code: question figure What will be output on the browser’s console?
Text of the picture (copyable)
```javascript
function outerFunc() {
  const val1 = 10;
  var val2 = 20;

  function innerFunc() {
    var val2 = 30;
    console.log(val1)
    console.log(val2)
  }
  innerFunc()
  console.log(val1)
  console.log(val2)
}
outerFunc()
```
  1. question figure
    text
    ```
    10 20
    10 30
    ```
  2. question figure
    text
    ```
    10 20
    10 20
    ```
  3. question figure
    text
    ```
    10 30
    10 20
    ```
  4. None of these.
Q12MCQ3 marks
What is logged to the console after running the following code? question figure
Text of the picture (copyable)
```javascript
const numbers = [10, 20, 30, 40, 50];
const [num1, , num2, ...rest] = numbers;
const [a = 100, b = 200] = [undefined, 0];

console.log(num1, num2, rest);
console.log(a, b);
```
  1. 10 30 [30, 40, 50] and 100 0
  2. 10 30 [40, 50] and 100 200
  3. 10 20 [30, 40, 50] and undefined 0
  4. 10 30 [40, 50] and 100 0
Q13MCQ3 marks
What is logged to the console after running the following code? question figure
Text of the picture (copyable)
```javascript
const user = {
  id: 1,
  profile: {
    name: "Riya",
    address: {
      city: "Pune",
      zip: "411001"
    }
  }
};

const {
  profile: {
    name,
    address: { city, state = "Maharashtra" }
  },
  role = "guest",
  profile
} = user;

console.log(name, city, state, role);
console.log(profile);
```
  1. text
    Riya Pune Maharashtra guest
    ```
    { name: "Riya", address: { city: "Pune", zip: "411001" } }
    ```
  2. text
    Riya Pune Maharashtra guest
    undefined
  3. text
    ```
    undefined undefined Maharashtra guest
    ```
    ```json
    { "name": "Riya", "address": { ...} }
    ```
  4. This code throws a , because you cannot destructure profile into nested variables and also assign it to a plain variable profile in the same statement.
    text
    SyntaxError
Q14MCQ3 marks
Consider the following JavaScript code: question figure What is the order of console output?
Text of the picture (copyable)
```javascript
console.log("1");
setTimeout(() => console.log("2"), 0);
Promise.resolve().then(() => console.log("3"));
console.log("4");
Promise.resolve().then(() => {
  console.log("5");
  setTimeout(() => console.log("6"), 0);
});
```
  1. 1, 4, 3, 5, 2, 6
  2. 1, 4, 3, 5, 6, 2
  3. 1, 3, 4, 5, 2, 6
  4. 1, 4, 2, 3, 5, 6
Q15MCQ3 marks
Match each Vue directive with its correct description: question figure
Text of the picture (copyable)
| Directive | Description |
|---|---|
| 1. v-if | A. Two-way binding between input and data |
| 2. v-for | B. Conditionally renders DOM elements |
| 3. v-bind | C. Binds HTML attributes dynamically |
| 4. v-model | D. Renders a list of items |
  1. 1–A, 2–D, 3–C, 4–B
  2. 1–D, 2–B, 3–C, 4–A
  3. 1–B, 2–D, 3–C, 4–A
  4. 1–B, 2–C, 3–D, 4–A
Q16MSQ3 marksselect all that apply
Which of the following is/are the advantage(s) of client-side storage?
  1. Saving web generated documents for offline use.
  2. The data can be stored across devices.
  3. Storing personalized site preferences.
  4. IndexedDB API is a kind of client-side storage which can be used for audio/video files.
Q17MSQ3 marksselect all that apply
Which of the following are valid capabilities of Lighthouse while analyzing a website?
  1. Measuring performance metrics such as FCP, LCP and TBT
  2. Simulating slow networks and throttled conditions
  3. Automatically fixing accessibility and SEO issues in the source code
  4. Emulating mobile and desktop devices
Q18MSQ3 marksselect all that apply
Given the following code, select all the statements that are TRUE about its execution if the code is run in a browser environment. question figure
Text of the picture (copyable)
```javascript
const calculator = {
  value: 10,
  add(a, b) {
    return this.value + a + b;
  }
};

const rawAdd = calculator.add;
const boundAdd = calculator.add.bind({ value: 100 }, 5);

console.log(rawAdd(1, 2));
console.log(boundAdd(10));
console.log(calculator.add.apply({ value: 50 }, [1, 2]));
```
  1. evaluates to
    text
    ```
    rawAdd(1, 2)
    ```
    NaN
  2. evaluates to
    text
    ```
    boundAdd(10)
    ```
    115
  3. evaluates to
    text
    ```
    calculator.add.apply({ value: 50 }, [1, 2])
    ```
    53
  4. throws a
    text
    ```
    calculator.add.apply({ value: 50 }, [1, 2])
    ```
    TypeError
Q19MSQ4.5 marksselect all that apply
Consider the following Flask JWT code: question figure A client first accesses and then tries to access . Which of the following statements are correct?
Text of the picture (copyable)
```python
from flask import Flask, jsonify
from flask_jwt_extended import JWTManager, create_access_token, \
    jwt_required

app = Flask(__name__)
app.config["JWT_SECRET_KEY"] = "secret"
jwt = JWTManager(app)

@app.route("/token")
def token():
    access_token = create_access_token(identity="Ravi")
    return jsonify(access_token=access_token)

@app.route("/dashboard")
@jwt_required()
def dashboard():
    return jsonify(message="Dashboard Access Granted")
```
/token
/dashboard
  1. can only be accessed if a valid JWT token is sent with the request.
    text
    /dashboard
  2. If the JWT token is missing or invalid, Flask-JWT-Extended returns an unauthorized error.
  3. The JWT token is typically sent in the header while accessing protected routes.
    text
    Authorization
  4. The token generated by is automatically stored by Flask and reused for future requests.
    text
    /token
Q20MSQ4.5 marksselect all that apply
Given the following code running in the browser, select all the statements that are about its output: question figure question figure
Text of the picture (copyable)
TRUE
```javascript
const value = "global";

const obj = {
  value: "objectValue",
  regularMethod: function () {
    console.log(this.value);
  },
  arrowMethod: () => {
    console.log(this.value);
  },
  nested: {
    value: "nestedValue",
    regularInNested: function () {
      console.log(this.value);
    },
    arrowInNested: () => {
      console.log(this.value);
    },
  },
  delayedRegular: function () {
    setTimeout(function () {
      console.log(this.value);
    }, 100);
  },
  delayedArrow: function () {
    setTimeout(() => {
      console.log(this.value);
    }, 100);
  },
};
```
```javascript
obj.regularMethod();
obj.arrowMethod();
obj.nested.regularInNested();
obj.nested.arrowInNested();
obj.delayedRegular();
obj.delayedArrow();
```
  1. logs "objectValue"
    text
    ```
    obj.regularMethod()
    ```
  2. logs "objectValue"
    text
    ```
    obj.arrowMethod()
    ```
  3. logs "nestedValue"
    text
    ```
    obj.nested.regularInNested()
    ```
  4. logs
    text
    ```
    obj.nested.arrowInNested()
    ```
    undefined
  5. logs "objectValue"
    text
    ```
    obj.delayedArrow()
    ```
  6. logs "objectValue"
    text
    ```
    obj.delayedRegular()
    ```
Q21MSQ4.5 marksselect all that apply
Consider the following code using flask_jwt_extended: question figure Which of the following statements are correct? (Select all that apply)
Text of the picture (copyable)
```python
app.config["JWT_SECRET_KEY"] = "my-secret"
jwt = JWTManager(app)

@jwt.user_identity_loader
def load(user):
    return user.username

@jwt.user_lookup_loader
def user_lookup(_jwt_header, jwt_data):
    identity = jwt_data["sub"]
    return User.query.filter_by(username=identity).one_or_none()

@app.route('/login', methods=["POST"])
def login():
    user = User.query.filter_by(username="u1").one_or_none()
    token = create_access_token(identity=user)
    return {"access_token": token}

@app.route('/dashboard')
@jwt_required()
def dashboard():
    return {
        "username": current_user.username
    }
```
  1. The decorator ensures that only requests with a valid JWT can access .
    text
    ```
    @jwt_required()
    ```
    /dashboard
  2. The determines what value is stored in the "sub" field of the JWT.
    text
    ```
    user_identity_loader
    ```
  3. If is removed, will not be automatically populated.
    text
    ```
    user_lookup_loader
    ```
    current_user
  4. The directly stores the entire user object inside the JWT.
    text
    ```python
    create_access_token(identity=user)
    ```
  5. If no JWT is sent in the request, will still execute but will be None.
    text
    /dashboard
    current_user
  6. The object is reconstructed using the identity extracted from the JWT.
    text
    current_user
Comprehension passage - the questions below it refer to this
Consider the following javascript code: question figure Note: Each sub question runs on its own, starting from the original 'user' object. Based on the above data, answer the given subquestions.
Q22MCQ2 marks
What will be logged in the console ? question figure
Text of the picture (copyable)
```javascript
const cloned = { ...user }

cloned.name = "Amit"
cloned.skills.push("JavaScript")

console.log(user.name)
console.log(user.skills.length)
```
  1. Rahul 2
  2. Amit 3
  3. Rahul 3
  4. Amit 2
Q23MCQ3 marks
What will be logged in the console ? question figure
Text of the picture (copyable)
```javascript
const cloned = {
  ...user,
  skills: [...user.skills]
}

cloned.skills.push("JavaScript")

console.log(user.skills.length)
console.log(cloned.skills.length)
```
  1. 2 3
  2. 3 3
  3. 2 2
  4. 3 2
Comprehension passage - the questions below it refer to this
Consider the following JavaScript code: question figure Based on the above data, answer the given subquestions.
Q24MCQ2 marks
What will be the output order?
  1. Start End Data Received
  2. Data Received Start End
  3. Start Data Received End
  4. End Start Data Received
Q25MSQ3 marksselect all that apply
Which of the following statements are correct?
  1. pauses the execution of the function until the Promise resolves.
    text
    await
    ```
    display()
    ```
  2. immediately returns the resolved string "Data Received".
    text
    ```
    fetchData()
    ```
  3. functions cannot return a .
    text
    async
    Promise
  4. Removing would cause to store a object instead of the resolved value.
    text
    await
    result
    Promise
Comprehension passage - the questions below it refer to this
Read the following Vue 2 component code carefully (using the Options API via CDN) and answer the given sub questions. question figure
Q26MCQ2 marks
If is accessed three times in a row in the template without price or discount changing in between, how many times does get logged?
Text of the picture (copyable)
discountedPrice
"computing..."
  1. 0
  2. 1
  3. 2
  4. 3
Q27MCQ3 marks
If is changed twice in two separate updates (100 to 120, then 120 to 150 on a later tick), what is the value of afterward?
Text of the picture (copyable)
price
```
logCount
```
  1. 0
  2. 1
  3. 2
  4. 3
Comprehension passage - the questions below it refer to this
Read the following code carefully and answer the given subquestions. tasks.py: question figure Called from a view/script: question figure Checked immediately, right after delay() — worker hasn't processed it yet: question figure Called separately, after waiting for the worker to finish the task: question figure
Q28MCQ2 marks
What do the two print statements, print(result) and print(type(result)) in the first code block output?
  1. text
    10 **and** <class 'int'>
  2. text
    A task ID string and <class 'celery.result.AsyncResult'>
  3. text
    None and <class 'NoneType'>
  4. text
    10 and <class 'celery.result.AsyncResult'>
Q29MCQ3 marks
What do print(check.status) (checked immediately) and the later print(check.get(timeout=5)) (checked after the worker finishes) output?
  1. "PENDING" and 10
  2. "SUCCESS" and 10
  3. 10 and "SUCCESS"
  4. "PENDING" and "SUCCESS"
Comprehension passage - the questions below it refer to this
Read the following router and component setup carefully and answer the given sub questions: Router setup: question figure component's method: question figure
Q30MCQ2 marks
What URL does navigate the browser to?
Text of the picture (copyable)
```
goToProduct()
```
  1. /#/product/42
  2. /#/product?id=42
  3. /#/product/:id
  4. /#/42
Q31MCQ2 marks
What URL does navigate the browser to?
Text of the picture (copyable)
```
goToSearch()
```
  1. /#/search/shoes/2
  2. /#/search?keyword=shoes&page=2
  3. /#/search:keyword=shoes:page=2
  4. /#/search
Q32MCQ2 marks
Inside component, what expression correctly reads the value from the URL after navigation?
Text of the picture (copyable)
SearchResults
keyword
  1. this.$router.query.keyword
  2. this.$route.query.keyword
  3. this.query.keyword
  4. this.$router.params.keyword

Answer key

  1. Q1 (MCQ, 2 marks): C
  2. Q2 (MCQ, 4.5 marks): C
  3. Q3 (MCQ, 4.5 marks): D
  4. Q4 (MCQ, 4.5 marks): D
  5. Q5 (MCQ, 4.5 marks): D
  6. Q6 (MCQ, 4.5 marks): A
  7. Q7 (MCQ, 3 marks): D
  8. Q8 (MCQ, 3 marks): D
  9. Q9 (MCQ, 3 marks): A
  10. Q10 (MCQ, 3 marks): D
  11. Q11 (MCQ, 3 marks): C
  12. Q12 (MCQ, 3 marks): D
  13. Q13 (MCQ, 3 marks): A
  14. Q14 (MCQ, 3 marks): A
  15. Q15 (MCQ, 3 marks): C
  16. Q16 (MSQ, 3 marks): A, C, D
  17. Q17 (MSQ, 3 marks): A, B, D
  18. Q18 (MSQ, 3 marks): A, B, C
  19. Q19 (MSQ, 4.5 marks): A, B, C
  20. Q20 (MSQ, 4.5 marks): A, C, D, E
  21. Q21 (MSQ, 4.5 marks): A, B, C, F
  22. Q22 (MCQ, 2 marks): C
  23. Q23 (MCQ, 3 marks): A
  24. Q24 (MCQ, 2 marks): C
  25. Q25 (MSQ, 3 marks): A, D
  26. Q26 (MCQ, 2 marks): B
  27. Q27 (MCQ, 3 marks): C
  28. Q28 (MCQ, 2 marks): B
  29. Q29 (MCQ, 3 marks): A
  30. Q30 (MCQ, 2 marks): A
  31. Q31 (MCQ, 2 marks): B
  32. Q32 (MCQ, 2 marks): B