uiz Space

May 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I End Term: 31 August 2025, Set QDB3 (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 QDB3: 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
25
MSQ
7

Updated

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

Question 1

+2 marksOne correct option
  1. A

    Riya

  2. B

    Name stored in database

  3. C

    None

  4. D

    Error

Show answer

Correct answer

  • A

    Riya

Question 2

+2 marksOne correct option

What does SQLAlchemy's lazy='dynamic' do?

  1. A

    Loads extra content of all the tables

  2. B

    Returns a query object that can be filtered

  3. C

    Loads all related records immediately

  4. D

    Forces join queries at once

Show answer

Correct answer

  • B

    Returns a query object that can be filtered

Question 3

+2 marksOne correct option

Why is using the GET method for sensitive data discouraged?

  1. A

    GET encrypts the URL

  2. B

    Data becomes part of browser history and URL

  3. C

    It uses a separate request header

  4. D

    Flask doesn’t support GET by default

Show answer

Correct answer

  • B

    Data becomes part of browser history and URL

Question 4

+2 marksOne correct option

You define two routes in your Flask app as:

python
@app.route('/home')
def home():
return "Home No Slash"
@app.route('/about/')
def about():
return "About With Slash"

A user visits /about (without the trailing slash). What will Flask do?

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

Correct answer

  • B

Question 5

+2 marksOne correct option

A login form doesn't show any message when users enter wrong credentials. Which Nielsen heuristic is violated?

  1. A

    Aesthetic and minimalist design

  2. B

    Visibility of system status

  3. C

    Error prevention

  4. D

    Recognition rather than recall

Show answer

Correct answer

  • B

    Visibility of system status

Question 6

+2 marksOne or more correct options

Which of the following are handled by the browser and not the Flask server?

Select all that apply.

  1. A

    Parsing HTML

  2. B

    Auto-filling saved form data

  3. C

    URL routing

  4. D

    JavaScript execution

Show answer

Correct answers

  • A

    Parsing HTML

  • B

    Auto-filling saved form data

  • D

    JavaScript execution

Question 7

+3 marksOne correct option

Consider the following git branches for a remote repository.

text
feature1
* feature2
main

Choose the correct git command sequence to merge feature1 and feature2 into the main branch.

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

Correct answer

  • C

Question 8

+3 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 9

+3 marksOne correct option

What will be displayed when running python app.py 8080 for the following script?

app.py

python
import sys
port = int(sys.argv[1]) if len(sys.argv) > 1 else 5000
print(f"Server running on port {port}")
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 10

+3 marksOne correct option

Consider the following Flask code.

python
from flask import Flask
import sys
app = Flask(__name__)
# Read multiplier from command-line
MULTIPLIER = int(sys.argv[1]) if len(sys.argv) > 1 else 1
@app.route('/multiply/<int:number>')
def multiply(number):
return f"Result: {number % MULTIPLIER}"
if __name__ == '__main__':
app.run()

What will be the output when you run the following code in the terminal python app.py 5 and then access in the browser with the following link http://localhost:5000/multiply/4 ?

  1. A

    Result: 20

  2. B

    Result: 1

  3. C

    Result: 5

  4. D

    Result: 4

Show answer

Correct answer

  • D

    Result: 4

Question 11

+3 marksOne correct option

Consider the following Python code

File name: main_test.py

python
import pytest
class TestGroup:
def do_something(self, x, y):
return x % y
def test_one(self):
assert self.do_something(10, 5) == 0, " Is 5 factor of 10? "
def test_two(self):
assert self.do_something(32, 5) == 0, " Is 5 factor of 32 "

What will be the output of running the above python script using command line “pytest -v main_test.py”?

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

Correct answer

  • A

Question 12

+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

  • D

Question 13

+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 14

+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

  • C

Question 15

+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

  • D

Question 16

+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

  • C

Question 17

+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-c, 4-a, 5-b

  4. D

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

Show answer

Correct answer

  • D

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

Question 18

+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

  • B

Question 19

+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
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 20

+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

  • C

Question 21

+4.5 marksOne correct option

Consider the following Python code snippet:

python: app.py

python
from string import Template
from jinja2 import Template as JinjaTemplate
import sys
mode = sys.argv[1]
data = {"user": "Bob", "language": "JavaScript", "project": "web app", "status": "completed"}
template_str = "Hello ${user}! Your {{project}} written in {{language}} is ${status}."
if mode == "hybrid":
str_template = Template(template_str)
intermediate = str_template.substitute(data)
jinja_template = JinjaTemplate(intermediate)
result = jinja_template.render(data)
print(result)
else:
jinja_template = JinjaTemplate(template_str)
result = jinja_template.render(data)
print(result)

What will be printed on the terminal for the command: python app.py hybrid ?

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

Correct answer

  • C

Question 22

+3 marksOne or more correct options

Consider the following Flask app code.

python
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class MyApiResource(Resource):
def get(self):
return {"response": "GET"}, 200
def post(self, value):
return {"response": "POST", "value": value}, 200
api.add_resource(MyApiResource, "/", "/<int:value>")
if __name__ == "__main__":
app.run(debug=True)

The above flask app is running on “http://127.0.0.1:5000”. Which of the following commands will return a runtime error?

Select all that apply.

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

Correct answers

  • A
  • C

Question 23

+3 marksOne or more correct options

Select all that apply.

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

Correct answers

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

  • C
  • 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

  • C
  • D

Question 26

+4.5 marksOne or more correct options

Consider the following Flask application.

python
from flask import Flask, abort, request
app = Flask(__name__)
courses = {
"IT2001": "Web Development",
"IT2002": "Database Systems",
"IT2003": "Software Engineering",
"IT2004": "Data Structures"
}
@app.route('/course')
def get_course():
course_id = request.args.get('id')
level = request.args.get('level', 'beginner')
if not course_id:
abort(400, "Bad Request: Course ID is required")
if course_id not in courses:
abort(404, "Not Found: Course does not exist")
return f'<h2>{courses[course_id]} - Level: {level.title()}</h2>'
@app.route('/search')
def search_courses():
query = request.args.get('q')
min_length = int(request.args.get('min', 3))
if not query or len(query) < min_length:
abort(422, "Unprocessable Entity: Query too short")
results = [name for name in courses.values() if query.lower() in name.lower()]
if not results:
return '<p>No courses found</p>'
return f'<ul>{"".join([f"<li>{course}</li>" for course in results])}</ul>'
app.run(debug=True)

Based on the above data, answer the given subquestions.

Select all that apply.

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

Correct answers

  • A
  • C
  • D

Question 27

+3 marksOne or more correct options

Consider the following Flask application.

python
from flask import Flask, abort, request
app = Flask(__name__)
courses = {
"IT2001": "Web Development",
"IT2002": "Database Systems",
"IT2003": "Software Engineering",
"IT2004": "Data Structures"
}
@app.route('/course')
def get_course():
course_id = request.args.get('id')
level = request.args.get('level', 'beginner')
if not course_id:
abort(400, "Bad Request: Course ID is required")
if course_id not in courses:
abort(404, "Not Found: Course does not exist")
return f'<h2>{courses[course_id]} - Level: {level.title()}</h2>'
@app.route('/search')
def search_courses():
query = request.args.get('q')
min_length = int(request.args.get('min', 3))
if not query or len(query) < min_length:
abort(422, "Unprocessable Entity: Query too short")
results = [name for name in courses.values() if query.lower() in name.lower()]
if not results:
return '<p>No courses found</p>'
return f'<ul>{"".join([f"<li>{course}</li>" for course in results])}</ul>'
app.run(debug=True)

Based on the above data, answer the given subquestions.

Analyze the following URLs and their expected behaviors. Which statement is CORRECT?

Select all that apply.

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

Correct answers

  • C
  • D
  • E

Question 28

+4.5 marksOne correct option

Consider the following Flask-RESTful resource class for a student management system:

python
class StudentResource(Resource):
def get(self, student_id=None):
if student_id:
return {"message": "Student details", "id": student_id}, 200
return {"message": "All students"}, 200
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('name', required=True, help='Name is required')
parser.add_argument('age', type=int, required=True, help='Age is required')
args = parser.parse_args()
return {"message": "Student created", "data": args}, 201
def put(self, student_id):
return {"message": "Student updated", "id": student_id}, 200
def delete(self, student_id):
return {"message": "Student deleted", "id": student_id}, 204
class CourseResource(Resource):
def get(self, course_code):
return {"course": course_code, "status": "active"}, 200
def post(self, course_code, student_id):
return {
"message": "Student enrolled",
"course": course_code,
"student_id": student_id
}, 201
api.add_resource(StudentResource, '/students', '/students/<int:student_id>')
api.add_resource(CourseResource, '/courses/<string:course_code>',
'/courses/<string:course_code>/enroll/<int:student_id>')
if __name__ == '__main__':
app.run(debug=True)

Based on the above data, answer the given subquestions.

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

Correct answer

  • C

Question 29

+3 marksOne correct option

Consider the following Flask-RESTful resource class for a student management system:

python
class StudentResource(Resource):
def get(self, student_id=None):
if student_id:
return {"message": "Student details", "id": student_id}, 200
return {"message": "All students"}, 200
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('name', required=True, help='Name is required')
parser.add_argument('age', type=int, required=True, help='Age is required')
args = parser.parse_args()
return {"message": "Student created", "data": args}, 201
def put(self, student_id):
return {"message": "Student updated", "id": student_id}, 200
def delete(self, student_id):
return {"message": "Student deleted", "id": student_id}, 204
class CourseResource(Resource):
def get(self, course_code):
return {"course": course_code, "status": "active"}, 200
def post(self, course_code, student_id):
return {
"message": "Student enrolled",
"course": course_code,
"student_id": student_id
}, 201
api.add_resource(StudentResource, '/students', '/students/<int:student_id>')
api.add_resource(CourseResource, '/courses/<string:course_code>',
'/courses/<string:course_code>/enroll/<int:student_id>')
if __name__ == '__main__':
app.run(debug=True)

Based on the above data, answer the given subquestions.

Consider the following HTTP requests to the same Flask-RESTful application.

What will be the response status code for each request?

Request 1: curl http://127.0.0.1:5000/students -X POST -d "name=Ashish"

Request 2: curl http://127.0.0.1:5000/courses/CS101/enroll/456 -X POST

Request 3: curl http://127.0.0.1:5000/students/789 -X DELETE

  1. A

    Request 1: 400, Request 2: 201, Request 3: 204

  2. B

    Request 1: 201, Request 2: 201, Request 3: 204

  3. C

    Request 1: 400, Request 2: 405, Request 3: 204

  4. D

    Request 1: 201, Request 2: 405, Request 3: 200

Show answer

Correct answer

  • A

    Request 1: 400, Request 2: 201, Request 3: 204

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

    Alex scored eighty and received grade F

  3. C

    Error 500: Internal Server Error

  4. D

    Invalid marks for Alex

Show answer

Correct answer

  • D

    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 0 and received grade F

  3. C

    Guest scored 88 and received grade B

  4. D

    Invalid marks for Guest

Show answer

Correct answer

  • C

    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

    Invalid marks for Anya

  3. C

    Anya scored 0 and received grade F

  4. D

    Anya scored 59 and received grade F

Show answer

Correct answer

  • B

    Invalid marks for Anya