uiz Space

September 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 1: 26 October 2025 (September 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 26 Oct 2025, in the September 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
12
MSQ
4

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 26 Oct 2025 · No negative marking.

Question 1

+2 marksOne correct option

Which of the following is the correct syntax to display the total number of courses in a Jinja2 template?

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

Correct answer

  • B

Question 2

+2 marksOne correct option

Consider the following code:

app.py

python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def port():
return "This is the port question."
if __name__ == "__main__":
app.run(port=5008)

You are running a Flask web application locally using the command: python app.py. On which URL will the application be accessible on the browser?

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

Correct answer

  • D

Question 3

+3 marksOne correct option
  1. A

    Statement 1 is correct, but statement 2 is incorrect.

  2. B

    Statement 2 is correct, but statement 1 is incorrect.

  3. C

    Both statements 1 and 2 are correct

  4. D

    Both statements 1 and 2 are incorrect

Show answer

Correct answer

  • B

    Statement 2 is correct, but statement 1 is incorrect.

Question 4

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

Correct answer

  • D

Question 5

+3 marksOne correct option

Consider two Python files, main.py and utils.py with the following code snippets.

File1: main.py

python
import sys
import utils
print('Processing: ' + sys.argv[2])

File2: utils.py

python
import sys
print('Module: ' + sys.argv[0])

What is the output of the following command "python main.py data.txt output.txt" when run on terminal?

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

Correct answer

  • C

Question 6

+3 marksOne correct option
  1. A

    1 → B, 2 → C, 3 → D, 4 → A

  2. B

    1 → A, 2 → B, 3 → C, 4 → D

  3. C

    1 → B, 2 → D, 3 → C, 4 → A

  4. D

    1 → C, 2 → D, 3 → A, 4 → B

Show answer

Correct answer

  • C

    1 → B, 2 → D, 3 → C, 4 → A

Question 7

+3 marksOne or more correct options

Consider the following Python code snippet.

python
from jinja2 import Template as JTemplate
from string import Template as STemplate
data = {'name1': 'Alice', 'name2': 'name1',
'age1': '25', 'age2': 'age1',
'job1': 'Engineer', 'job2': 'job1'}
jt = JTemplate("{{name2}} is {{age2}} years old and works as a {{job2}}.")
result1 = jt.render(data)
print(result1) #first print statement
st = STemplate(result1)
result2 = st.substitute(data)
print(result2) #second print statement

If the above Python code runs on the terminal, which of the following statements is/are correct?

Select all that apply.

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

Correct answers

  • A
  • C
  • D

Question 8

+3 marksOne or more correct options

Select all that apply.

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

Correct answers

  • A
  • C

Question 9

+4.5 marksOne correct option

Consider the following HTML and CSS code:

html
<html>
<head>
<style>
div {
width: 0px;
margin: 0px;
}
.container {
width: 200px;
padding: 15px;
border: 5px solid black;
}
#box {
margin: 10px;
}
</style>
</head>
<body>
<div class="container" id="box">Hello World</div>
</body>
</html>

What is the total width (approximately ) of the div with class="container" and id="box", including content, padding, and border but excluding margin?

  1. A

    200 px

  2. B

    230 px

  3. C

    240 px

  4. D

    250 px

Show answer

Correct answer

  • C

    240 px

Question 10

+4.5 marksOne correct option

Consider the following code:

python
from flask import Flask, request, render_template_string
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
name = request.form['name']
template = "Hello, {{ name }}!"
return render_template_string(template, name=name)
return '''
<form method="POST">
Enter Your Name: <input type="text" name="name">
<button>Submit</button>
</form>
'''
if __name__ == '__main__':
app.run(debug=True)

You are building a Flask web application that takes user input from an HTML form and displays it using Jinja2 templates. Suppose the user runs this app locally and submits the name Alice in the form.

Which of the following represents the correct sequence of concepts that occur when the user submits the form with the name Alice ?

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

Correct answer

  • C

Question 11

+2 marksOne or more correct options

Select all that apply.

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

Correct answers

  • A
  • B
  • C

Question 12

+2 marksOne or more correct options

Select all that apply.

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

Correct answers

  • A
  • B

Question 13

+4.5 marksOne correct option

Consider the following Python code snippet.

Filename: server.py

python
from flask import Flask, request
import sys
app = Flask(__name__)
@app.route('/api/data', methods=sys.argv[1:])
def handle_data():
if request.method == 'GET':
return "<h1>Data retrieved successfully</h1>"
elif request.method == 'PUT':
return "<h1>Data updated successfully</h1>"
elif request.method == 'DELETE':
return "<h1>Data deleted successfully</h1>"
else:
return "<h1>Unsupported operation</h1>"
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

  • B

Question 14

+3 marksOne correct option

Consider the following Python code snippet.

Filename: server.py

python
from flask import Flask, request
import sys
app = Flask(__name__)
@app.route('/api/data', methods=sys.argv[1:])
def handle_data():
if request.method == 'GET':
return "<h1>Data retrieved successfully</h1>"
elif request.method == 'PUT':
return "<h1>Data updated successfully</h1>"
elif request.method == 'DELETE':
return "<h1>Data deleted successfully</h1>"
else:
return "<h1>Unsupported operation</h1>"
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 15

+4.5 marksOne correct option

Consider the following Flask code:

python
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/login', method="GET")
def login(id):
name = request.form.get('name', 'Guest')
return render_template("login.html", name=name)
if __name__ == '__main__':
app.run(debug=True)

login.html

html
<body>
{{ name }}
<form action="/login" method="POST">
<input type="text" name="name" placeholder="Enter your name">
<button type="submit">Submit</button>
</form>
</body>

Based on the above data, answer the given subquestions.

From the given options, select which part of the code (if any) will throw an error first in the terminal and prevent the Flask application from running successfully ?

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

Correct answer

  • A

Question 16

+3 marksOne correct option

Consider the following Flask code:

python
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/login', method="GET")
def login(id):
name = request.form.get('name', 'Guest')
return render_template("login.html", name=name)
if __name__ == '__main__':
app.run(debug=True)

login.html

html
<body>
{{ name }}
<form action="/login" method="POST">
<input type="text" name="name" placeholder="Enter your name">
<button type="submit">Submit</button>
</form>
</body>

Based on the above data, answer the given subquestions.

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

Correct answer

  • B