uiz Space

May 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 2: 3 August 2025 (May 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 2 paper sat on 3 Aug 2025, in the May 2025 term: 16 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
16
Marks
50
Duration
120 min
MCQ
10
MSQ
5
Numerical
1

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 03 Aug 2025 · No negative marking.

Question 1

+2 marksOne correct option

You manage a datacenter where each server has a 10 Gigabit per second network connection and the facility’s backbone link is also 10 Gbps. Your application is handling 10,000 requests per second, each with a 50 KB response, which translates to about 4 Gbps of required throughput. So, if each request involves minimal CPU processing, and the existing server has sufficient resources to handle the load. Which of the following scaling strategies is most appropriate to meet this demand?

  1. A

    Scale up on a single server

  2. B

    Scale out to multiple servers in the datacenter

  3. C

    Both will produce similar results

  4. D

    None of these

Show answer

Correct answer

  • A

    Scale up on a single server

Question 2

+2 marksOne correct option

Which of the following statements BEST describes a key advantage of Jinja2 server-side rendering over JavaScript/JSON-based client-side rendering?

  1. A

    It guarantees that dynamic updates on user interactions never require additional data fetches.

  2. B

    It provides faster initial page load and improved Search Engine Optimization without requiring client-side template logic.

  3. C

    It allows the client to handle all template rendering, reducing load on the server.

  4. D

    None of these

Show answer

Correct answer

  • B

    It provides faster initial page load and improved Search Engine Optimization without requiring client-side template logic.

Question 3

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

Correct answer

  • B

Question 4

+2 marksOne correct option

What is the right syntax to use an external JavaScript file(.js) into the current html file?

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

Correct answer

  • A

Question 5

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

Correct answer

  • D

Question 6

+3 marksOne correct option

Consider the following Python code.

File name: main.py

python
def calculate(funx):
def wrapper(a, b):
x = funx(a, b)
return x**2
return wrapper
@calculate
def foo(x, y):
return x - y
# main code
print(foo(5, 2))

What is the correct output of the given code?

  1. A

    10

  2. B

    9

  3. C

    3

  4. D

    4

Show answer

Correct answer

  • B

    9

Question 7

+3 marksOne correct option

Consider the following Python code snippet.

python
from string import Template
msg = "The $lang programming language is $desc and $useful for web development."
template = Template(msg)
print(=== OUTPUT ===)

Which of the following statements, when substituted in place of === OUTPUT ===, will throw a KeyError?

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

Correct answer

  • A

Question 8

+3 marksOne correct option

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. What will be the output for the URL: “http://127.0.0.1:5000/signin?uid=professor&pwd=54321” ?

  1. A

    You are authorized!!

  2. B

    You are unauthorized!!

  3. C

    Not Found

  4. D

    Internal Server Error

Show answer

Correct answer

  • B

    You are unauthorized!!

Question 9

+4.5 marksOne correct option

Consider the following HTML code.

Filename: main.html

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Greetings</title>
</head>
<body>
<button onclick="alert('Hello, welcome')">Greet1!</button><br>
<button onclick="console.log('Hello, welcome')">Greet2!</button><br>
<button onclick="document.write('Hello, welcome')">Greet3!</button><br>
<button onclick="console.error('Hello, welcome')">Greet4!</button>
</body>
</html>
  1. A

    Greet4

  2. B

    Greet3

  3. C

    Greet2

  4. D

    Greet1

Show answer

Correct answer

  • D

    Greet1

Question 10

+4.5 marksOne correct option

Consider the following flask application.

python
from flask import Flask, abort
app = Flask(__name__)
users = ["admin", "user_1", "user_2", "user_3"]
@app.route('/home/<string:username>', methods = ['POST'])
def home(username):
if username in users:
return f"<h1>Hello {username}, Welcome!</h1>"
else:
abort(407)
@app.errorhandler(404)
def user_error_1(error):
return "<h1>The user you are looking for is invalid.</h1>"
@app.errorhandler(405)
def user_error_2(error):
return "<h1>Please check the web request.</h1>"
@app.errorhandler(407)
def user_error_4(error):
return "<h1>Proxy authentication required.</h1>"
app.run()

If the application is running locally on http://127.0.0.1:5000. What will be rendered on the browser for the URL http://127.0.0.1:5000/home/user_4 ?

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

Correct answer

  • D

Question 11

+3 marksOne or more correct options

Which of the following statements is/are false about caching in REST APIs?

Select all that apply.

  1. A

    Caching allows storing server responses in a proxy or frontend so that a client need not make requests to the server for the same resources repeatedly.

  2. B

    Caching degrades the overall quality of service and increases load on the servers.

  3. C

    Browsers treat all GET and POST requests cacheable by default.

  4. D

    Caching optimizes the network by increasing the latency.

Show answer

Correct answers

  • B

    Caching degrades the overall quality of service and increases load on the servers.

  • C

    Browsers treat all GET and POST requests cacheable by default.

  • D

    Caching optimizes the network by increasing the latency.

Question 12

+3 marksOne or more correct options

Which of the following is/are correct with respect to storing data in graphs?

Select all that apply.

  1. A

    Data on social networks can be stored with the help of graphs.

  2. B

    Graphs support storing attributes such as node degree, edge weights ,and other metadata.

  3. C

    Data is stored as a key-value pair.

  4. D

    In graphs, path finding is not as important as just searching the data.

Show answer

Correct answers

  • A

    Data on social networks can be stored with the help of graphs.

  • B

    Graphs support storing attributes such as node degree, edge weights ,and other metadata.

Question 13

+4.5 marksOne or more correct options

Consider the Flask Restful API code given below:

File name: app.py

python
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class APICalculator(Resource):
def post(self):
d = request.json
a = int(d["val1"])
b = int(d["val2"])
oper = d["operator"]
if oper == "+":
return {"Sum=": (a + b)}, 200
elif oper == "-":
return {"Difference=": (a - b)}, 200
elif oper == "*":
return {"Product=": (a * b)}, 200
else:
return {"Error": "Invalid option"}, 401
api.add_resource(APICalculator, "/")
app.run(debug=True)

Assume that the Flask server is running on http://127.0.0.1:5000. Which of the following is the correct curl command(s) that will return calculated values?
Note: Assume data sent is valid for cmd, and powershell

Select all that apply.

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

Correct answers

  • A
  • B
  • E

Question 14

+3 marksNumerical answer
Show answer

Correct answer: 2000

Question 15

+4.5 marksOne or more correct options

Consider the following sqlalchemy code and answer the given subquestions:

python
# models.py
from flask_sqlalchemy import SQLAlchemy
from datetime import date
db = SQLAlchemy()
class GlassRepair(db.Model):
__tablename__ = 'glass_repairs'
id = db.Column(db.Integer, primary_key=True)
broken_at = db.Column(db.Date, nullable=False)
fixed_at = db.Column(db.Date, nullable=False)
status = db.Column(db.String, nullable=False)

Select all that apply.

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

Correct answers

  • A
  • B

Question 16

+3 marksOne or more correct options

Consider the following sqlalchemy code and answer the given subquestions:

python
# models.py
from flask_sqlalchemy import SQLAlchemy
from datetime import date
db = SQLAlchemy()
class GlassRepair(db.Model):
__tablename__ = 'glass_repairs'
id = db.Column(db.Integer, primary_key=True)
broken_at = db.Column(db.Date, nullable=False)
fixed_at = db.Column(db.Date, nullable=False)
status = db.Column(db.String, nullable=False)

Select all that apply.

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

Correct answers

  • A
  • C