uiz Space

May 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 1: 13 July 2025 (May 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 13 Jul 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
13
Numerical
2
MSQ
1

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 13 July 2025 · No negative marking.

Question 1

+2 marksOne correct option

What will be the output of the following HTML code?

html
<!DOCTYPE html>
<html>
<head>
<title>Test List</title>
</head>
<body>
<dl>
<dt>Flask</dt>
<dd>A Python web framework.</dd>
<dt>SQLAlchemy</dt>
<dd>A database toolkit for Python.</dd>
</dl>
</body>
</html>
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 2

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

Correct answer

  • B

Question 3

+3 marksOne correct option

Consider the following HTML code snippet.

filename: index.html

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Document</title>
<style>
.container p.highlight { background-color: red; }
.content .special { background-color: blue; }
span.highlight { background-color: green; }
</style>
</head>
<body>
<div class="container">
<p class="highlight">Welcome to our site</p>
<div class="content">
<p>This is regular content</p>
<p class="highlight special">Important information</p>
<span class="highlight">Notice</span>
</div>
<p class="highlight">Footer text</p>
</div>
<p class="highlight">Welcome to our site</p>
</body>
</html>

Which elements from the above document will have a red background color?

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

Correct answer

  • C

Question 4

+3 marksOne correct option

Consider the following Python code snippet.

Filename: code.py

python
from string import Template as string_template
from jinja2 import Template as jinja_template
template1 = string_template('Hello $name, welcome to $city!')
template2 = jinja_template('{{product}} costs {{price}}')
result1 = template1.substitute(name='Alice')
result2 = template1.substitute(name='Alice', city='Boston', state='Massachusetts')
result3 = template2.render({"product": "laptop"})
result4 = template2.render({"product": "laptop", "price": "45000", "currency": "rupees"})
print(result1)
print(result2)
print(result3)
print(result4)

Which of the following statements will throw a key error?

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

Correct answer

  • A

Question 5

+3 marksOne correct option

What will be the output of the following Jinja2 template when rendered in Flask?

html
{% macro greet(name) %}
Hello, {{ name }}!
{% endmacro %}
<!DOCTYPE html>
<html>
<head>
<title>Jinja2 Macro Test</title>
</head>
<body>
{{ greet("Alice") }}
{{ greet("Bob") }}
</body>
</html>
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 6

+3 marksOne correct option

Consider the following Flask code snippet:

python
from flask import Flask, url_for, request, redirect
app = Flask(__name__)
@app.route("/signin/user")
def login():
return url_for("login")
@app.route("/")
def home():
return redirect(url_for("login"))
app.run(debug=True)

Assume the above code is running on server http://127.0.0.1:5000/ . What will be the output on a web browser for the URL: http://127.0.0.1:5000/ ?

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

Correct answer

  • B

Question 7

+3 marksOne correct option

Consider the following code:

html
<!DOCTYPE html>
<html>
<head>
<style>
p {
color: blue;
}
#highlight {
color: green;
}
.important {
color: red;
}
</style>
</head>
<body>
<p class="important" id="highlight">This is a paragraph.</p>
</body>
</html>

What will be the color of the paragraph text when rendered in a browser?

  1. A

    Blue

  2. B

    Green

  3. C

    Red

  4. D

    The browser default (black)

Show answer

Correct answer

  • B

    Green

Question 8

+4.5 marksOne correct option

Consider the following Python file “output.py”

File: “output.py”

python
from jinja2 import Template
output = """<!DOCTYPE html>
<body>
<ul>
<!--Missing Jinja2 implementation-->
</ul>
</body>
</html>
"""
l = [5, 4, 3, 2, 1]
t = Template(output)
output = t.render(sl=l)
print(output)

Which of the following code snippet when placed at <!--Missing Jinja2 implementation–> will render the below unordered list as shown below?

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

Correct answer

  • C

Question 9

+4.5 marksOne correct option

Consider the following Python code snippet:

main.py

python
import sys
def process(v):
# Missing code 1
v = sys.argv
# Missing code 2
print(output)

We are executing above main.py in command line with command python main.py 1 2 3 4 5 . Which of the following codes when replaced at #Missing code 1 and #Missing code 2 will render the output below:

1,2,3,4,5

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

Correct answer

  • D

Question 10

+3 marksNumerical answer

We want to use an online grammar checking tool, which takes each word from the client and sends it to the web server. The available network bandwidth between the client and the server is 2 Gbps. What should be the maximum allowed size(in MBs) of a document containing the word sent from the client to the server per second for the grammar check? (Use: 1KB= 1000Bytes, 1MB=1000KB and so on.)

Show answer

Correct answer: 250

Question 11

+3 marksNumerical answer

Consider a client which is located 3000 km from the server makes a request through the cable. Suddenly after the request reaches the server, the cable breaks and the response is now to be sent to the client via air. This change of medium caused an additional delay of 47 ms at the server end. How long will the client have to wait before receiving the response (in ms)? ( speed on cable = 2e8 m/s and in air 3e8 m/s)

Show answer

Correct answer: 72

Question 12

+4.5 marksOne or more correct options

Consider the following Python code snippet and answer the given subquestions

Filename: webapp.py

python
import sys
from jinja2 import Template
args = sys.argv
frameworks = {
'django': 'python',
'react': 'javascript',
'flask': 'python',
'vue': 'javascript'
}
languages = {
'python': 'server-side',
'javascript': 'client-side'
}
template = Template("{{ framework }} is a {{ lang_type }} {{ language }} framework.")
if len(args) >= 3 and args[1] in frameworks:
framework_name = args[1]
language = frameworks[framework_name]
if args[2] == 'type' and language in languages:
lang_type = languages[language]
print(template.render(framework=framework_name, language=language, lang_type=lang_type))
else:
print("Invalid second argument or language not found!")
else:
print("Invalid command")

Select all that apply.

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

Correct answers

  • B
  • C

Question 13

+2 marksOne correct option

Consider the following Python code snippet and answer the given subquestions

Filename: webapp.py

python
import sys
from jinja2 import Template
args = sys.argv
frameworks = {
'django': 'python',
'react': 'javascript',
'flask': 'python',
'vue': 'javascript'
}
languages = {
'python': 'server-side',
'javascript': 'client-side'
}
template = Template("{{ framework }} is a {{ lang_type }} {{ language }} framework.")
if len(args) >= 3 and args[1] in frameworks:
framework_name = args[1]
language = frameworks[framework_name]
if args[2] == 'type' and language in languages:
lang_type = languages[language]
print(template.render(framework=framework_name, language=language, lang_type=lang_type))
else:
print("Invalid second argument or language not found!")
else:
print("Invalid command")
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 14

+2 marksOne correct option

Consider the following Python code snippet and answer the given subquestions

Filename: webapp.py

python
import sys
from jinja2 import Template
args = sys.argv
frameworks = {
'django': 'python',
'react': 'javascript',
'flask': 'python',
'vue': 'javascript'
}
languages = {
'python': 'server-side',
'javascript': 'client-side'
}
template = Template("{{ framework }} is a {{ lang_type }} {{ language }} framework.")
if len(args) >= 3 and args[1] in frameworks:
framework_name = args[1]
language = frameworks[framework_name]
if args[2] == 'type' and language in languages:
lang_type = languages[language]
print(template.render(framework=framework_name, language=language, lang_type=lang_type))
else:
print("Invalid second argument or language not found!")
else:
print("Invalid command")
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 15

+4.5 marksOne correct option

Given the following code, answer the given subquestions:

python
from flask import Flask, request, render_template_string
app = Flask(__name__)
template = """
<!DOCTYPE html>
<html>
<head><title>Protein RDA</title></head>
<body>
<h2>Recommended Daily Protein Intake</h2>
<p>Gender: {{ gender }}</p>
<p>Weight: {{ weight_raw }}</p>
<p>Recommended Intake: <strong>{{ rda }} grams</strong></p>
</body>
</html>
"""
def parse_weight(weight_raw):
if weight_raw.endswith('kg'):
return float(weight_raw[:-2])
elif weight_raw.endswith('lb'):
return float(weight_raw[:-2]) * 0.453592
return float(weight_raw)
def protein_rda(gender, weight_kg):
return weight_kg * (0.8 if gender.lower() == 'male' else 0.75)
@app.route('/protein', methods=['GET'])
def protein():
gender = request.args.get('gender', 'male')
weight_raw = request.args.get('weight', '60kg')
weight_kg = parse_weight(weight_raw)
rda = int(round(protein_rda(gender, weight_kg)))
return render_template_string(template, gender=gender, weight_raw=weight_raw, rda=rda)
app.run(debug=True)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 16

+3 marksOne correct option

Given the following code, answer the given subquestions:

python
from flask import Flask, request, render_template_string
app = Flask(__name__)
template = """
<!DOCTYPE html>
<html>
<head><title>Protein RDA</title></head>
<body>
<h2>Recommended Daily Protein Intake</h2>
<p>Gender: {{ gender }}</p>
<p>Weight: {{ weight_raw }}</p>
<p>Recommended Intake: <strong>{{ rda }} grams</strong></p>
</body>
</html>
"""
def parse_weight(weight_raw):
if weight_raw.endswith('kg'):
return float(weight_raw[:-2])
elif weight_raw.endswith('lb'):
return float(weight_raw[:-2]) * 0.453592
return float(weight_raw)
def protein_rda(gender, weight_kg):
return weight_kg * (0.8 if gender.lower() == 'male' else 0.75)
@app.route('/protein', methods=['GET'])
def protein():
gender = request.args.get('gender', 'male')
weight_raw = request.args.get('weight', '60kg')
weight_kg = parse_weight(weight_raw)
rda = int(round(protein_rda(gender, weight_kg)))
return render_template_string(template, gender=gender, weight_raw=weight_raw, rda=rda)
app.run(debug=True)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B