uiz Space

May 2025 term · Modern Application Development II · BSCS2006

Modern Application Development II End Term: 31 August 2025, Set QDB1 (May 2025 term)

The IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 31 Aug 2025, in the May 2025 term, set QDB1: 32 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
32
Marks
100
Duration
180 min
MCQ
23
MSQ
9

Updated

Official paper: IIT M IMPROVEMENT AN EXAM QIB3 31 Aug 2025 · No negative marking.

Question 1

+2 marksOne correct option

In a message queue system, if the consumer is slower than the producer, what is likely to occur first?

  1. A

    Messages will be dropped

  2. B

    The producer will block until the consumer is ready

  3. C

    Messages will accumulate in the queue

  4. D

    The consumer will speed up automatically

Show answer

Correct answer

  • C

    Messages will accumulate in the queue

Question 2

+2 marksOne correct option
  1. A

    The component will reload when data changes

  2. B

    The DOM updates automatically when the underlying reactive data changes

  3. C

    All function calls become asynchronous

  4. D

    It disables direct access to state

Show answer

Correct answer

  • B

    The DOM updates automatically when the underlying reactive data changes

Question 3

+2 marksOne correct option

In Flask, what is the main benefit of using the @cache.cached() decorator?

  1. A

    It stores output in session storage

  2. B

    It skips route execution for repeated inputs

  3. C

    It enables token authentication

  4. D

    It sends compressed response headers

Show answer

Correct answer

  • B

    It skips route execution for repeated inputs

Question 4

+2 marksOne correct option

What is the primary purpose of CORS (Cross-Origin Resource Sharing)?

  1. A

    To encrypt data between client and server

  2. B

    To control which domains can access resources

  3. C

    To compress HTTP responses

  4. D

    To authenticate users across applications

Show answer

Correct answer

  • B

    To control which domains can access resources

Question 5

+2 marksOne or more correct options

Which of the following practices help protect against supply chain attacks?

Select all that apply.

  1. A

    Version pinning

  2. B

    Storing keys only in environment variables

  3. C

    Reduce Dependencies

  4. D

    Using only packages with over 1000 stars on GitHub

Show answer

Correct answers

  • A

    Version pinning

  • C

    Reduce Dependencies

Question 6

+2 marksOne or more correct options

Which of the following factors directly affect the speed and performance of a web page load?

Select all that apply.

  1. A

    The number of CSS selectors in the stylesheet

  2. B

    Number of HTTP requests made

  3. C

    File size of resources (like images, JS)

  4. D

    Use of semantic HTML tags

Show answer

Correct answers

  • B

    Number of HTTP requests made

  • C

    File size of resources (like images, JS)

Question 7

+2 marksOne or more correct options

Which of the following is/are the potential benefits of using a message broker?

Select all that apply.

  1. A

    A message broker allows two servers in a network to directly communicate with each other, without an intermediary.

  2. B

    A message broker makes the network scalable for adding more servers to the network.

  3. C

    A message broker can be used for batch processing of messages.

  4. D

    A message broker is not suited in case of traffic spikes, as messages are retained in the queue until processed.

Show answer

Correct answers

  • B

    A message broker makes the network scalable for adding more servers to the network.

  • C

    A message broker can be used for batch processing of messages.

Question 8

+2 marksOne or more correct options

Which statements about webhooks are correct?

Select all that apply.

  1. A

    They enable real-time data delivery

  2. B

    They require polling from the client

  3. C

    They use HTTP POST requests typically

  4. D

    They're designed for server-to-server communication

Show answer

Correct answers

  • A

    They enable real-time data delivery

  • C

    They use HTTP POST requests typically

  • D

    They're designed for server-to-server communication

Question 9

+3 marksOne correct option

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. A

    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. B

    Webhooks provide an ideal solution as they allow the e-commerce platform to push 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.

  3. C

    Webhooks should be avoided in this scenario because they operate synchronously, meaning the customer's order placement would be delayed until all third-party services have successfully processed their notifications.

  4. D

    Webhooks are primarily designed for read-only operations and cannot handle complex data payloads like order information, making them unsuitable for e-commerce transaction notifications.

Show answer

Correct answer

  • B

    Webhooks provide an ideal solution as they allow the e-commerce platform to push 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.

Question 10

+3 marksOne correct option

What is the main advantage of using caching in a Flask-based web application?

  1. A

    It eliminates the need for client-side rendering

  2. B

    It encrypts data transmission between server and client

  3. C

    It avoids the need for database interactions completely

  4. D

    It reduces server load by reusing responses for repeated requests

Show answer

Correct answer

  • D

    It reduces server load by reusing responses for repeated requests

Question 11

+3 marksOne correct option

What will be the order of console output when the following JavaScript code is executed?

javascript
async function test() {
console.log("P");
await Promise.resolve();
console.log("Q");
}
console.log("R");
test();
console.log("S");
  1. A

    R P Q S

  2. B

    P R S Q

  3. C

    R P S Q

  4. D

    R S P Q

Show answer

Correct answer

  • C

    R P S Q

Question 12

+3 marksOne correct option

Consider the following Vue application with markup index.html and JavaScript file app.js.

File: index.html

html
<div id="app"></div>
<script src="script.js"></script>

File: script.js

javascript
new Vue({
el: '#app',
template: `<div>
Process: {{process}}<br>
Count: {{count}}
</div>`,
data: {
process: "Start",
count: 5,
},
beforeCreate() {
this.process = this.process + " -> Init"
this.count = this.count + 2
},
created() {
this.process = this.process + " -> Ready"
this.count = this.count * 2
},
beforeMount() {
this.process = this.process + " -> Render"
this.count = this.count - 3
},
mounted() {
this.process = this.process + " -> Complete"
this.count = this.count / 2
},
})

Suppose the application is running on http://127.0.0.1:8080. What will be rendered by the browser?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 13

+3 marksOne correct option

Consider the below JavaScript program.

html
<script>
for (let j = 1; j <= 4; j++) {
setTimeout(() => console.log(j * 2), j * 1000);
}
</script>

What will be the output of the above program, if executed? Also, predict the minimum number of seconds the program will take to complete the execution?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 14

+3 marksOne correct option
  1. A

    object, undefined, true, false

  2. B

    null, undefined, false, false

  3. C

    object, undefined, false, false

  4. D

    null, undefined, true, true

Show answer

Correct answer

  • A

    object, undefined, true, false

Question 15

+3 marksOne correct option

Consider the following Vue router configuration.

javascript
const routes = [
{ path: '/admin', component: Admin },
{ path: '/unauthorized', component: Unauthorized },
];
const router = new VueRouter({ routes });
new Vue({
el: '#app',
data: {
userRole: 'user'
},
mounted() {
if (this.userRole !== 'admin') {
this.$router.push('/unauthorized');
} else {
this.$router.push('/admin');
}
},
router
});

If the app loads with userRole = 'user', what will be displayed?

  1. A

    Admin component

  2. B

    Unauthorized component

  3. C

    Blank screen

  4. D

    Vue throws a routing error

Show answer

Correct answer

  • B

    Unauthorized component

Question 16

+3 marksOne correct option

Consider the following JavaScript program:

javascript
class Vehicle {
constructor(brand) {
this.brand = brand;
}
start() {
console.log(`${this.brand} vehicle is starting`);
}
getInfo() {
return `This is a ${this.brand} vehicle`;
}
}
class Car extends Vehicle {
constructor(brand, model) {
super(brand);
this.model = model;
}
start() {
console.log(`${this.brand} ${this.model} engine started`);
}
}
const myCar = new Car('Toyota', 'Camry');
myCar.start();
console.log(myCar.getInfo());
console.log(myCar instanceof Car);
console.log(myCar instanceof Vehicle);
console.log(Car.prototype.__proto__ === Vehicle.prototype);

What will be the output of the above program on a browsers console?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 17

+3 marksOne correct option

Given the following parent-child component setup:

Parent Component: App.vue

html
<template>
<div>
<h2>Selected Tasks</h2>
<task-list :tasks="tasks" @task-selected="addToSelection" />
<p>Total Selected: {{ selectedTasks.length }}</p>
<ul>
<li v-for="task in selectedTasks" :key="task.id">{{ task.name }}</li>
</ul>
</div>
</template>
<script>
import TaskList from './TaskList.vue';
export default {
components: { TaskList },
data() {
return {
tasks: [
{ id: 1, name: 'Design UI' },
{ id: 2, name: 'Write Backend' },
{ id: 3, name: 'Write Tests' }
],
selectedTasks: []
};
},
methods: {
addToSelection(task) {
const exists = this.selectedTasks.some(t => t.id === task.id);
if (!exists) {
this.selectedTasks.push(task);
}
}
}
};
</script>

Child Component: TaskList.vue

html
<template>
<div>
<h3>All Tasks</h3>
<ul>
<li v-for="task in tasks" :key="task.id">
{{ task.name }}
<button @click="select(task)">Select</button>
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['tasks'],
methods: {
select(task) {
this.$emit('task-selected', task);
}
}
};
</script>

Test Scenario

  1. The app loads.
  2. User clicks "Select" on Design UI and Write Backend in order.
  3. User clicks "Select" on Design UI again.

Based on the above data, answer the given subquestions.

After step 2 (selecting two tasks), what is the value of selectedTasks.length?

  1. A

    0

  2. B

    1

  3. C

    2

  4. D

    3

Show answer

Correct answer

  • C

    2

Question 18

+3 marksOne correct option

Given the following parent-child component setup:

Parent Component: App.vue

html
<template>
<div>
<h2>Selected Tasks</h2>
<task-list :tasks="tasks" @task-selected="addToSelection" />
<p>Total Selected: {{ selectedTasks.length }}</p>
<ul>
<li v-for="task in selectedTasks" :key="task.id">{{ task.name }}</li>
</ul>
</div>
</template>
<script>
import TaskList from './TaskList.vue';
export default {
components: { TaskList },
data() {
return {
tasks: [
{ id: 1, name: 'Design UI' },
{ id: 2, name: 'Write Backend' },
{ id: 3, name: 'Write Tests' }
],
selectedTasks: []
};
},
methods: {
addToSelection(task) {
const exists = this.selectedTasks.some(t => t.id === task.id);
if (!exists) {
this.selectedTasks.push(task);
}
}
}
};
</script>

Child Component: TaskList.vue

html
<template>
<div>
<h3>All Tasks</h3>
<ul>
<li v-for="task in tasks" :key="task.id">
{{ task.name }}
<button @click="select(task)">Select</button>
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['tasks'],
methods: {
select(task) {
this.$emit('task-selected', task);
}
}
};
</script>

Test Scenario

  1. The app loads.
  2. User clicks "Select" on Design UI and Write Backend in order.
  3. User clicks "Select" on Design UI again.

Based on the above data, answer the given subquestions.

What happens when the user clicks "Select" on Design UI again (step 3)?

  1. A

    It is added again, making the total 3

  2. B

    It replaces the previous task

  3. C

    Nothing changes, no duplicate is added

  4. D

    Vue throws a warning about duplicate keys

Show answer

Correct answer

  • C

    Nothing changes, no duplicate is added

Question 19

+3 marksOne or more correct options

Given the following parent-child component setup:

Parent Component: App.vue

html
<template>
<div>
<h2>Selected Tasks</h2>
<task-list :tasks="tasks" @task-selected="addToSelection" />
<p>Total Selected: {{ selectedTasks.length }}</p>
<ul>
<li v-for="task in selectedTasks" :key="task.id">{{ task.name }}</li>
</ul>
</div>
</template>
<script>
import TaskList from './TaskList.vue';
export default {
components: { TaskList },
data() {
return {
tasks: [
{ id: 1, name: 'Design UI' },
{ id: 2, name: 'Write Backend' },
{ id: 3, name: 'Write Tests' }
],
selectedTasks: []
};
},
methods: {
addToSelection(task) {
const exists = this.selectedTasks.some(t => t.id === task.id);
if (!exists) {
this.selectedTasks.push(task);
}
}
}
};
</script>

Child Component: TaskList.vue

html
<template>
<div>
<h3>All Tasks</h3>
<ul>
<li v-for="task in tasks" :key="task.id">
{{ task.name }}
<button @click="select(task)">Select</button>
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['tasks'],
methods: {
select(task) {
this.$emit('task-selected', task);
}
}
};
</script>

Test Scenario

  1. The app loads.
  2. User clicks "Select" on Design UI and Write Backend in order.
  3. User clicks "Select" on Design UI again.

Based on the above data, answer the given subquestions.

Which of the following statements about this component setup are true?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • B
  • C

Question 20

+3 marksOne or more correct options

Which factors directly impact the Lighthouse "Performance" score?

Select all that apply.

  1. A

    First Contentful Paint (FCP)

  2. B

    HTTPS usage

  3. C

    Time to Interactive (TTI)

  4. D

    Layout Shift

Show answer

Correct answers

  • A

    First Contentful Paint (FCP)

  • C

    Time to Interactive (TTI)

  • D

    Layout Shift

Question 21

+3 marksOne or more correct options

Which statements are true about handling background tasks in Flask with Celery?

Select all that apply.

  1. A

    Celery allows long-running tasks to be executed asynchronously

  2. B

    Polling is a strategy to check task status periodically

  3. C

    Using time.sleep() blocks the event loop and is recommended for async tasks

  4. D

    Flask + Celery + Redis is a common stack for async task management

Show answer

Correct answers

  • A

    Celery allows long-running tasks to be executed asynchronously

  • B

    Polling is a strategy to check task status periodically

  • D

    Flask + Celery + Redis is a common stack for async task management

Question 22

+3 marksOne or more correct options

Which of the following are true about mutations and actions in Vuex?

Select all that apply.

  1. A

    Mutations can be asynchronous

  2. B

    Actions can be asynchronous

  3. C

    Only actions can call APIs through fetch call

  4. D

    Mutations should modify state directly

Show answer

Correct answers

  • B

    Actions can be asynchronous

  • C

    Only actions can call APIs through fetch call

  • D

    Mutations should modify state directly

Question 23

+3 marksOne or more correct options

Select all that apply.

  1. A

    The class "active" will only be applied to the div element if the variable "isActive" evaluates to true.

  2. B

    The class "text-bold" will always be applied to the div element regardless of the "hasBoldText" variable value.

  3. C

    The class "disabled" will be applied to the div element when the variable "isEnabled" evaluates to false.

  4. D

    All three classes ("active", "text-bold", "disabled") will always be applied to the div element.

  5. E

    The class "text-bold" will only be applied if the variable "hasBoldText" exists and evaluates to a truthy value.

  6. F

    If "isEnabled" is undefined, the "disabled" class will not be applied to the div element.

Show answer

Correct answers

  • A

    The class "active" will only be applied to the div element if the variable "isActive" evaluates to true.

  • C

    The class "disabled" will be applied to the div element when the variable "isEnabled" evaluates to false.

  • E

    The class "text-bold" will only be applied if the variable "hasBoldText" exists and evaluates to a truthy value.

Question 24

+4.5 marksOne correct option

Consider the following JavaScript program:

javascript
const user = {
name: 'Alice',
age: 25,
city: 'Boston',
country: 'USA'
};
const { name, city, ...otherInfo } = user;
const newUser = { name, location: city, ...otherInfo };
console.log(name);
console.log(otherInfo);
console.log(newUser);

What will be the output of the above program?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 25

+4.5 marksOne correct option

Consider the following JavaScript code snippet:

javascript
async function process() {
console.log("A");
const result = await Promise.resolve("Data");
console.log("B");
console.log(result);
return "Complete";
}
console.log("X");
process().then(value => console.log(value));
console.log("Y");
setTimeout(() => console.log("Z"), 0);
console.log("W");

What will be the output sequence?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 26

+4.5 marksOne correct option

What will this Promise chain output?

javascript
Promise.resolve(15)
.then(x => {
console.log("Step 1:", x);
return x * 2;
})
.then(x => {
console.log("Step 2:", x);
throw new Error("Oops!");
})
.catch(err => {
console.log("Caught:", err.message);
return 100;
})
.then(x => {
console.log("Step 3:", x);
});
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 27

+4.5 marksOne correct option

What happens when this Flask caching code runs?

python
from flask import Flask
from flask_caching import Cache
import time
app = Flask(__name__)
app.config['CACHE_TYPE'] = 'SimpleCache'
app.config['CACHE_DEFAULT_TIMEOUT'] = 300
cache = Cache(app)
@cache.memoize(timeout=300)
def expensive_calculation(user_id):
time.sleep(5)
return f"Result for user {user_id}"
@app.route('/api/data/<int:user_id>')
def get_data(user_id):
return expensive_calculation(user_id)

If requests for user IDs 1, 2, 1 are made within 5 minutes, what's the total response time?

  1. A

    15 seconds

  2. B

    10 seconds

  3. C

    5 seconds

  4. D

    0 seconds

Show answer

Correct answer

  • B

    10 seconds

Question 28

+4.5 marksOne correct option

What happens when the following code is run in the browser (Vue 2 CDN used)?

javascript
new Vue({
el: '#app',
data: {
items: ['apple', 'banana']
},
beforeCreate() {
console.log('Before:', this.items);
this.items.push('orange');
},
created() {
console.log('Created:', this.items);
this.items.push('grape');
},
template: '<div v-for="item in items">{{ item }}</div>'
});
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 29

+4.5 marksOne correct option

What does this async/await code do?

javascript
async function fetchUserData(userId) {
try {
const response = await fetch(`/api/user/${userId}`);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.log('Error:', error.message);
return null;
}
}
fetchUserData(123).then(result => console.log('Result:', result));

If the API returns 404 status, what gets logged?

  1. A

    Result: null

  2. B

    Error: HTTP 404, Result: null

  3. C

    Error: HTTP 404

  4. D

    Unhandled promise rejection

Show answer

Correct answer

  • B

    Error: HTTP 404, Result: null

Question 30

+4.5 marksOne correct option

Consider the following JavaScript program that demonstrates web storage operations:

javascript
localStorage.setItem('user', 'Alice');
localStorage.setItem('theme', 'dark');
sessionStorage.setItem('user', 'Bob');
sessionStorage.setItem('cart', 'item1,item2');
console.log("A:", localStorage.getItem('user'));
console.log("B:", sessionStorage.getItem('user'));
localStorage.setItem('user', JSON.stringify({name: 'Charlie', age: 25}));
sessionStorage.removeItem('user');
console.log("C:", localStorage.getItem('user'));
console.log("D:", sessionStorage.getItem('user'));
console.log("E:", sessionStorage.getItem('cart'));
console.log("F:", localStorage.length);
console.log("G:", sessionStorage.length);
localStorage.removeItem('theme');
sessionStorage.clear();
console.log("H:", localStorage.length);
console.log("I:", sessionStorage.length);

What will be the output of the above program?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 31

+3 marksOne correct option

Answer the given subquestions.

Consider the following Flask application configuration for Flask-Security with the User and Role models properly defined with flask-sqlalchemy

python
class LocalDevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = "sqlite:///securedb.sqlite3"
DEBUG = True
SECRET_KEY = "this-is-a-secret-key"
SECURITY_PASSWORD_HASH = "bcrypt"
SECURITY_PASSWORD_SALT = "this-is-a-salt-key"
WTF_CSRF_ENABLED = False
SECURITY_TOKEN_AUTHENTICATION_HEADER = "Authentication-Token"

A user registration request is made with the password "mypassword123". Based on this configuration, which of the following statements is MOST ACCURATE?

  1. A

    The password will be stored as plain text "mypassword123" in the database because WTF_CSRF_ENABLED = False

  2. B

    The password will be hashed using bcrypt with the salt "this-is-a-salt-key" before being stored in the database

  3. C

    The password will be hashed using SHA-256 algorithm since no specific hashing method is configured

  4. D

    The password will be encrypted using the SECRET_KEY and stored in the session only

Show answer

Correct answer

  • A

    The password will be stored as plain text "mypassword123" in the database because WTF_CSRF_ENABLED = False

Question 32

+4.5 marksOne correct option

Answer the given subquestions.

Consider the following endpoints created with a working set up of flask-security and flask-sqlalchemy.

python
@app.route('/api/public')
def public_endpoint():
return jsonify({'message': 'Public access', 'status': 'success'})
@app.route('/api/protected')
@auth_required('token')
def protected_endpoint():
return jsonify({'message': 'Protected access', 'status': 'authenticated'})
@app.route('/api/admin')
@auth_required('token')
@roles_required('admin')
def admin_endpoint():
return jsonify({'message': 'Admin access', 'status': 'authorized'})

Three requests are made to this application:

  1. GET /api/public (no authentication headers)
  2. GET /api/protected (no authentication headers)
  3. GET /api/admin with valid authentication token but user has role (not 'admin')

What will be the response status codes for these requests, respectively?

  1. A

    200, 200, 200

  2. B

    200, 401, 403

  3. C

    200, 401, 401

  4. D

    401, 401, 403

Show answer

Correct answer

  • B

    200, 401, 403