uiz Space

May 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I End Term: 31 August 2025, Set QDD1 (May 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) End Term paper sat on 31 Aug 2025, in the May 2025 term, set QDD1: 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
26
MSQ
6

Updated

Official paper: IIT M DIPLOMA FN EXAM QDD1 31 Aug 2025 · No negative marking.

Question 1

+2 marksOne correct option

You're designing an API to update a user's profile picture but your database has 4 records in a row, profile picture is one of them. Which HTTP method is most appropriate?

  1. A

    POST

  2. B

    PATCH

  3. C

    PUT

  4. D

    DELETE

Show answer

Correct answer

  • B

    PATCH

Question 2

+2 marksOne correct option

What is the correct sequence of operations when receiving a form in Flask?

  1. A

    Validate → Render → Access → Store

  2. B

    Access → Store → Validate → Render

  3. C

    Access → Validate → Store → Redirect

  4. D

    POST → GET → Redirect → Validate

Show answer

Correct answer

  • C

    Access → Validate → Store → Redirect

Question 3

+2 marksOne correct option

Consider the following statements and choose the correct option
Statement 1: It is mandatory to implement server-side validations and client-side validations. Statement 2: Server-side validations can be implemented using HTML5.

  1. A

    Statement 1 is false, while statement 2 is true

  2. B

    Statement 1 is true, while statement 2 is false

  3. C

    Both statements are false

  4. D

    Both statements are true

Show answer

Correct answer

  • C

    Both statements are false

Question 4

+2 marksOne correct option

What will be the output when accessing http://localhost:5000/user/42 in the following Flask app?

python
from flask import Flask
app = Flask(__name__)
@app.route('/user/<uid>')
def show_user(uid):
return f"User ID: {uid * 2}"
app.run(debug=True)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 5

+2 marksOne correct option

Consider the following HTML form:

html
<form action="/search" method="get">
<input type="text" name="q">
<input type="submit">Search</input>
</form>

What URL will be generated when the user enters "flask" in the input box and clicks on the submit button?

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

Correct answer

  • B

Question 6

+3 marksOne correct option

You're creating a registration form. The form is written as:

html
<form action="/register" method="post">

And in Flask:

python
@app.route("/register")
def register():
return "Form received"

When the user submits the form, they see a 405 Method Not Allowed error. Why is this happening?

  1. A

    There is no return statement inside the function

  2. B

    The form is missing CSRF protection

  3. C

    The Flask route does not allow POST method

  4. D

    The route should have a trailing slash

Show answer

Correct answer

  • C

    The Flask route does not allow POST method

Question 7

+3 marksOne correct option

You created the following templates:

base.html

html
<html>
<body>
{% block content %}{% endblock %}
</body>
</html>

home.html

html
{% extends "base.html" %}
<h1>Welcome!</h1>

But when rendered, "Welcome!" doesn't appear. Why?

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

Correct answer

  • B

Question 8

+3 marksOne correct option

A user downloads a 10 MB file from a server with 5 Mbps speed. How long does it approximately take?

  1. A

    2 seconds

  2. B

    10 seconds

  3. C

    16 seconds

  4. D

    1.6 seconds

Show answer

Correct answer

  • C

    16 seconds

Question 9

+3 marksOne correct option

Suppose you have these models in your Flask-SQLAlchemy app:

python
class Author(db.Model):
id = db.Column(db.Integer, primary_key=True)
books = db.relationship('Book', backref='author', cascade="all, delete")
class Book(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(80))
author_id = db.Column(db.Integer, db.ForeignKey('author.id'))

If you delete an Author instance from the database, what happens to their related Book instances?

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

Correct answer

  • B

Question 10

+3 marksOne correct option

Consider the following HTML code snippet (without any CSS styling).

html
<div>
<p>This is paragraph 1</p>
<span>Span element 1</span>
<span>Span element 2</span>
<p>This is paragraph 2</p>
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<div>Nested div content</div>
<strong>Bold text</strong>
<em>Italic text</em>
</div>

Which of the following statements correctly describes how the elements will be displayed by default in a browser?

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

Correct answer

  • C

Question 11

+3 marksOne correct option

Consider the following HTML document with internal CSS and inline styles.

html
<!DOCTYPE html>
<html>
<head>
<style>
p {
color: blue;
font-size: 16px;
font-weight: normal;
}
.highlight {
color: red;
font-weight: bold;
}
#special {
color: green;
font-size: 20px;
}
p.highlight {
color: orange;
}
</style>
</head>
<body>
<p class="highlight" id="special" style="color: purple; font-size: 14px;">
Paragraph 5
</p>
</body>
</html>

What will be the final color and font-size for "Paragraph 5"?

  1. A

    Color: green, Font-size: 20px

  2. B

    Color: orange, Font-size: 14px

  3. C

    Color: purple, Font-size: 20px

  4. D

    Color: purple, Font-size: 14px

Show answer

Correct answer

  • D

    Color: purple, Font-size: 14px

Question 12

+3 marksOne correct option
  1. A

    1-c, 2-a, 3-d, 4-b

  2. B

    1-d, 2-c, 3-a, 4-b

  3. C

    1-c, 2-d, 3-b, 4-a

  4. D

    1-c, 2-d, 3-a, 4-b

Show answer

Correct answer

  • D

    1-c, 2-d, 3-a, 4-b

Question 13

+3 marksOne correct option

Consider the following Python code.

File name: main.py

python
def funA(func):
def inner_wrapper():
print("Wrapper function of funA")
res1 = func()
res2 = func()
return res1, res2
return inner_wrapper
@funA
def funB():
return "I am from funB"
print(funB())

What will be the output, when running the above code using the command “python main.py”?

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

Correct answer

  • B

Question 14

+3 marksOne correct option

Consider the HTML code below, what will be the text color of the paragraph?

html
<!DOCTYPE html>
<head>
<style>
p { color: blue; }
p.important { color: red; }
#main p.important { color: green; }
</style>
</head>
<body>
<div id="main">
<p class="important">Hello World!</p>
</div>
</body>
</html>
  1. A

    Blue

  2. B

    Red

  3. C

    Green

  4. D

    Black

Show answer

Correct answer

  • C

    Green

Question 15

+3 marksOne correct option
  1. A

    1-a, 2- c, 3-b, 4-d, 5-e

  2. B

    1-b, 2- c, 3-a, 4-e, 5-d

  3. C

    1-e, 2- d, 3-b, 4-a, 5-c

  4. D

    1-e, 2- d, 3-c, 4-a, 5-b

Show answer

Correct answer

  • C

    1-e, 2- d, 3-b, 4-a, 5-c

Question 16

+4.5 marksOne correct option

You are working on a team project hosted on GitHub. After making changes to your local files, you run the following commands in this exact order:

bash
git status
git add .
git commit -m "Fixed header bug"
git push
git pull

Assuming your teammate pushed a new change just before you did git push, what is the most likely outcome?

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

Correct answer

  • D

Question 17

+4.5 marksOne correct option

Consider the following Python script that processes command line arguments and uses Jinja2 templates.

python: app.py

python
import sys
from jinja2 import Template
pre_message = sys.argv[1] if len(sys.argv) > 1 else ""
pre_language = sys.argv[2] if len(sys.argv) > 2 else "unknown"
post_message = pre_message.strip().lower().replace(" ", "_")
post_language = pre_language.capitalize()
template_string = """
<div>
<h1>{{ post_message | upper }}</h1>
<p>Message: {{ post_message }}</p>
<p>Language: {{ post_language }}</p>
<p>Count: {{ pre_message | length }}</p>
</div>
"""
template = Template(template_string)
output = template.render(
pre_message = pre_message,
post_message = post_message,
post_language = post_language
)
print(output)

If the script is run with the command:

bash

bash
python app.py " Hello World " "python"

What will be the output for the following template variables?

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

Correct answer

  • B

Question 18

+4.5 marksOne correct option

Consider the following Flask application structure and code.

text
my_project/
├── app.py
├── views/
│ └── dashboard.html
├── templates/
│ ├── base.html
│ └── home.html
└── custom_templates/
├── admin/
│ └── login.html
└── user/
└── profile.html

app.py:

python
from flask import Flask, render_template
app = Flask(__name__, template_folder='custom_templates')
@app.route('/')
def home():
return render_template('home.html')
@app.route('/admin')
def admin_login():
return render_template('admin/login.html')
@app.route('/profile')
def user_profile():
return render_template('user/profile.html')
@app.route('/dashboard')
def dashboard():
return render_template('dashboard.html')
if __name__ == '__main__':
app.run(debug=True)

Which of the following statements about the template rendering behavior is correct?

  1. A

    All routes will work correctly as Flask will automatically search in both templates/ and custom_templates/ folders

  2. B

    The / and /dashboard routes will fail with TemplateNotFound error, while /admin and /profile routes will work correctly

  3. C

    Only the /admin and /profile routes will work correctly, while / and /dashboard routes will fail with TemplateNotFound error

  4. D

    All routes will fail because Flask requires the template folder to be named exactly templates

Show answer

Correct answer

  • C

    Only the /admin and /profile routes will work correctly, while / and /dashboard routes will fail with TemplateNotFound error

Question 19

+4.5 marksOne correct option

Examine the following Python code snippet.

File: logger_test.py

python
import logging
import sys
logging.basicConfig(level=logging.WARNING,
format='%(asctime)s - %(levelname)s - %(message)s')
def process_data(num):
logging.debug("Starting data processing")
logging.info("Processing number: %d", num)
if num == 0:
logging.warning("Zero value detected - potential division by zero")
return None
elif num < 0:
logging.error("Negative number provided: %d", num)
return None
else:
result = 100 / num
logging.info("Calculation completed successfully")
return result
try:
input_num = int(sys.argv[1])
result = process_data(input_num)
if result:
print(f"Result: {result}")
except IndexError:
logging.critical("No command line argument provided")
except ValueError:
logging.error("Invalid input - not a number")

What will be the output when running the command: python logger_test.py -5 ?

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

Correct answer

  • D

Question 20

+2 marksOne or more correct options

Which statements about REST API design are correct?

Select all that apply.

  1. A

    PUT requests should be idempotent

  2. B

    GET requests can have request bodies for complex queries

  3. C

    PATCH is used for partial updates

  4. D

    DELETE must return the deleted resource

Show answer

Correct answers

  • A

    PUT requests should be idempotent

  • C

    PATCH is used for partial updates

Question 21

+3 marksOne or more correct options

Select all that apply.

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

Correct answers

  • B
  • D

Question 22

+3 marksOne or more correct options

Consider the following Python code.

python
from string import Template
output = "List of courses in IITM BS Diploma : $c1, $c2, $c3, $c4, $c5"
my_template = Template(output)
print(==Missing code here===)

Which of the following statement(s) prints the output without any KeyError exception?

Select all that apply.

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

Correct answers

  • A
  • B
  • C
  • D

Question 23

+3 marksOne or more correct options

Consider the following Flask app code.

python
from flask import Flask, request
valid_users = [
{"uid": "student", "pwd": "12345"},
{"uid": "professor", "pwd": "54321"},
{"uid": "hod", "pwd": "abcde"},
]
app = Flask(__name__)
@app.route("/signin")
def login():
args = request.args
for vu in valid_users:
if vu["uid"] == args["uid"] and vu["pwd"] == args["pwd"]:
return "You are authorized!!"
else:
return "You are unauthorized!!"
app.run(debug=True)

Assume the above flask app runs on “http://127.0.0.1:5000/” and is accessed through the web browser. Select the URL(s) that render Not Found error.

Select all that apply.

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

Correct answers

  • B
  • D

Question 24

+4.5 marksOne or more correct options

Examine the following Python test file:

Filename: math_tests.py

python
import pytest
def multiply(a, b):
return a * b
def divide(a, b):
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
@pytest.mark.unit
def test_multiply_positive():
assert multiply(3, 4) == 12
@pytest.mark.integration
def test_divide_normal():
assert divide(10, 2) == 5.0
@pytest.mark.slow
@pytest.mark.integration
def test_complex_calculation():
result = divide(multiply(6, 7), 2)
assert result == 21.0
@pytest.mark.unit
def test_multiply_negative():
assert multiply(-2, 3) == -6

Consider the following pytest command output:

text
========= 1 passed, 3 deselected in 0.02s =========

Which of the following pytest commands would produce the output shown above?

Select all that apply.

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

Correct answers

  • B
  • D

Question 25

+4.5 marksOne or more correct options

Select all that apply.

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

Correct answers

  • A
  • B

Question 26

+4.5 marksOne correct option

Prashant and Nikita are creating a quiz question paper collaboratively. They are each working on different sections — and complete their tasks in parallel. Meanwhile, Mayur is enjoying a single-player game that finishes when the game loop ends.

To compare productivity:

  • If Prashant and Nikita (together) finish faster than Mayur, the winner is "Team".
  • If Mayur finishes faster, he wins.
  • If both take the same time, Mayur wins by default.

Prashant and Nikita send their task completion times to a Flask backend via query parameters.The server must simulate parallel execution of their tasks (i.e., max(prashant_time, nikita_time)) and compare it against Mayur's game time. The route returns who finishes faster.

python
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/task')
def task():
prashant_time = int(request.args.get("prashant"))
nikita_time = int(request.args.get("nikita", 3))
mayur_time = int(request.args.get("mayur", 6))
team_time = max(prashant_time, nikita_time) # parallel processing
winner = "Team" if team_time < mayur_time else "Mayur"
return jsonify({
"winner": winner,
"team_time": team_time,
"mayur_time": mayur_time
})

Based on the above data, answer the given subquestions.

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

Correct answer

  • B

Question 27

+3 marksOne correct option

Prashant and Nikita are creating a quiz question paper collaboratively. They are each working on different sections — and complete their tasks in parallel. Meanwhile, Mayur is enjoying a single-player game that finishes when the game loop ends.

To compare productivity:

  • If Prashant and Nikita (together) finish faster than Mayur, the winner is "Team".
  • If Mayur finishes faster, he wins.
  • If both take the same time, Mayur wins by default.

Prashant and Nikita send their task completion times to a Flask backend via query parameters.The server must simulate parallel execution of their tasks (i.e., max(prashant_time, nikita_time)) and compare it against Mayur's game time. The route returns who finishes faster.

python
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/task')
def task():
prashant_time = int(request.args.get("prashant"))
nikita_time = int(request.args.get("nikita", 3))
mayur_time = int(request.args.get("mayur", 6))
team_time = max(prashant_time, nikita_time) # parallel processing
winner = "Team" if team_time < mayur_time else "Mayur"
return jsonify({
"winner": winner,
"team_time": team_time,
"mayur_time": mayur_time
})

Based on the above data, answer the given subquestions.

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

Correct answer

  • D

Question 28

+4.5 marksOne correct option

Consider the following Flask-SQLAlchemy models for a library management system:

File: models.py

python
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Library(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), unique=True, nullable=False)
location = db.Column(db.String(200), nullable=False)
books = db.relationship('Book', backref='library_ref', lazy=True)
class Author(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
email = db.Column(db.String(120), unique=True, nullable=True)
books = db.relationship('Book', backref='author_ref', lazy=True)
class Book(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(150), nullable=False)
isbn = db.Column(db.String(13), unique=True, nullable=False)
library_id = db.Column(db.Integer, db.ForeignKey('library.id'), nullable=False)
author_id = db.Column(db.Integer, db.ForeignKey('author.id'), nullable=False)
is_available = db.Column(db.Boolean, default=True)

File: app.py

python
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/books/<int:library_id>', methods=['GET'])
def get_library_books(library_id):
library = Library.query.get_or_404(library_id)
available_books = Book.query.filter_by(
library_id=library_id,
is_available=True
).all()
result = []
for book in available_books:
result.append({
'id': book.id,
'title': book.title,
'author': book.author_ref.name,
'isbn': book.isbn
})
return jsonify({
'library': library.name,
'location': library.location,
'available_books': result
})

Based on the above data, answer the given subquestions.

Which of the following statements about the database schema and model relationships is correct?

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

Correct answer

  • C

Question 29

+3 marksOne correct option

Consider the following Flask-SQLAlchemy models for a library management system:

File: models.py

python
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Library(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), unique=True, nullable=False)
location = db.Column(db.String(200), nullable=False)
books = db.relationship('Book', backref='library_ref', lazy=True)
class Author(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
email = db.Column(db.String(120), unique=True, nullable=True)
books = db.relationship('Book', backref='author_ref', lazy=True)
class Book(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(150), nullable=False)
isbn = db.Column(db.String(13), unique=True, nullable=False)
library_id = db.Column(db.Integer, db.ForeignKey('library.id'), nullable=False)
author_id = db.Column(db.Integer, db.ForeignKey('author.id'), nullable=False)
is_available = db.Column(db.Boolean, default=True)

File: app.py

python
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/books/<int:library_id>', methods=['GET'])
def get_library_books(library_id):
library = Library.query.get_or_404(library_id)
available_books = Book.query.filter_by(
library_id=library_id,
is_available=True
).all()
result = []
for book in available_books:
result.append({
'id': book.id,
'title': book.title,
'author': book.author_ref.name,
'isbn': book.isbn
})
return jsonify({
'library': library.name,
'location': library.location,
'available_books': result
})

Based on the above data, answer the given subquestions.

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

Correct answer

  • D

Question 30

+3 marksOne correct option

Consider the following flask code and answer the given subquestions.

python
from flask import Flask, request
app = Flask(__name__)
@app.route('/score')
def score():
name = request.args.get('name', 'Guest')
try:
marks = int(request.args.get('marks', 0))
except ValueError:
return f"Invalid marks for {name}"
if marks >= 90:
grade = "A"
elif marks >= 75:
grade = "B"
elif marks >= 60:
grade = "C"
else:
grade = "F"
return f"{name} scored {marks} and received grade {grade}"
app.run(debug=True)
  1. A

    Alex scored 0 and received grade F

  2. B

    Invalid marks for Alex

  3. C

    Alex scored eighty and received grade F

  4. D

    Error 500: Internal Server Error

Show answer

Correct answer

  • B

    Invalid marks for Alex

Question 31

+2 marksOne correct option

Consider the following flask code and answer the given subquestions.

python
from flask import Flask, request
app = Flask(__name__)
@app.route('/score')
def score():
name = request.args.get('name', 'Guest')
try:
marks = int(request.args.get('marks', 0))
except ValueError:
return f"Invalid marks for {name}"
if marks >= 90:
grade = "A"
elif marks >= 75:
grade = "B"
elif marks >= 60:
grade = "C"
else:
grade = "F"
return f"{name} scored {marks} and received grade {grade}"
app.run(debug=True)
  1. A

    Guest scored 88 and received grade A

  2. B

    Guest scored 88 and received grade B

  3. C

    Guest scored 0 and received grade F

  4. D

    Invalid marks for Guest

Show answer

Correct answer

  • B

    Guest scored 88 and received grade B

Question 32

+2 marksOne correct option

Consider the following flask code and answer the given subquestions.

python
from flask import Flask, request
app = Flask(__name__)
@app.route('/score')
def score():
name = request.args.get('name', 'Guest')
try:
marks = int(request.args.get('marks', 0))
except ValueError:
return f"Invalid marks for {name}"
if marks >= 90:
grade = "A"
elif marks >= 75:
grade = "B"
elif marks >= 60:
grade = "C"
else:
grade = "F"
return f"{name} scored {marks} and received grade {grade}"
app.run(debug=True)
  1. A

    Anya scored 59.5 and received grade F

  2. B

    Anya scored 0 and received grade F

  3. C

    Invalid marks for Anya

  4. D

    Anya scored 59 and received grade F

Show answer

Correct answer

  • C

    Invalid marks for Anya