uiz Space

January 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I End Term: 13 April 2025, Set QDD3 (January 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) End Term paper sat on 13 Apr 2025, in the January 2025 term, set QDD3: 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
24
MSQ
8

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD3 13 Apr 2025 · No negative marking.

Question 1

+2 marksOne correct option

A certain text document consisting of only alphanumeric characters (including spaces) takes 320000 bits, when encoded with UCS-2 encoding. How many bits will the same document take if encoded with ASCII 7-bit encoding?

  1. A

    20000 bits

  2. B

    1,40,000 bits

  3. C

    22,40,000 bits

  4. D

    320000 bits

Show answer

Correct answer

  • B

    1,40,000 bits

Question 2

+2 marksOne correct option

Which of the following is true about the term “stateful” in the client-server model?

  1. A

    The server keeps the state of the client to respond to the required request.

  2. B

    Server is ready to respond to the client's request without knowing anything about the client.

  3. C

    Server uses various HTTP methods to respond to the client's request.

  4. D

    Server uses the URL to convey context to the client.

Show answer

Correct answer

  • A

    The server keeps the state of the client to respond to the required request.

Question 3

+2 marksOne correct option

Consider the following git branches for a remote repository.

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

Correct answer

  • D

Question 4

+3 marksOne correct option

The Quiz Master application at IITM BS allows students to attempt quizzes online. To prevent automated bots from mass-submitting quiz answers and ensure fair participation, the admin decides to implement a CAPTCHA verification system before allowing users to start a quiz. The admin decides to integrate Google reCAPTCHA into the Quiz Master app using Flask. Which Flask extension is best suited for implementing reCAPTCHA verification?

  1. A

    Flask-Mail

  2. B

    Flask-WTF

  3. C

    Flask-SQLAlchemy

  4. D

    Flask-Migrate

Show answer

Correct answer

  • B

    Flask-WTF

Question 5

+3 marksOne correct option

A mobile client starts from and is cruising away continuously at 120 kmph from the network tower whose network range is 80 km and bandwidth is 240 Mbps. How much data (in Gigabytes) will be consumed by the client who is continuously using the entire bandwidth before completely moving out of the network?
[Take 1 Byte = 8 bits, 1 KB = 1000 Bytes, 1 MB = 1000 Kilobytes and so on.]
[Consider the speed of light in air to be 3 x 10 ⁸ m/sec.]

  1. A

    48

  2. B

    57.6

  3. C

    72

  4. D

    576

Show answer

Correct answer

  • C

    72

Question 6

+3 marksOne correct option

Consider the code below in a file called test_students.py

test_students.py

python
import pytest
@pytest.fixture
def students():
return { "names": ["ravi", "raj"], "ages": [12, 9]}
def test_name(students):
assert "ravi" in students['names']
def test_age(students):
assert students['ages'][0] > 9

Which of these is the correct output when the command “pytest -k name” is run in the terminal?

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

Correct answer

  • A

Question 7

+3 marksOne correct option

Consider the following models Department and Student corresponding to tables department and student in SQLite database.

python
class Department(db.Model):
id = db.Column(db.Integer(), primary_key = True)
name = db.Column(db.String(), unique = True)
class Student(db.Model):
id = db.Column(db.Integer(), primary_key = True)
name = db.Column(db.String(), unique = True)
department = db.Column(db.Integer(), db.ForeignKey("faculty.id"))

Based on the model schemas, what relationship do the classes Department and Student share?

  1. A

    Many-to-Many

  2. B

    One-to-Many

  3. C

    One-to-One

  4. D

    The tables are not at all related

Show answer

Correct answer

  • D

    The tables are not at all related

Question 8

+3 marksOne correct option

Consider the following statements and choose the correct option
Statement 1: It is always mandatory to implement server-side validations and client-side validations to create web applications.
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 9

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

Correct answer

  • D

Question 10

+3 marksOne correct option

Consider the following example:

html
<form>
<label for="search-input">Search for a word:</label>
<input
type="text"
id="search-input"
placeholder="Type a word to search"
aria-describedby="search-help"
required
/>
<small id="search-help">Enter a word to find relevant results.</small>
<button type="submit">Start Search</button>
</form>

Which of the following accessibility principles is followed in this example?

  1. A

    Perceivable

  2. B

    Operable

  3. C

    Robust

  4. D

    Understandable

Show answer

Correct answer

  • D

    Understandable

Question 11

+3 marksOne correct option
  1. A

    3000

  2. B

    9000

  3. C

    6000

  4. D

    12000

Show answer

Correct answer

  • C

    6000

Question 12

+3 marksOne correct option

Consider the following flask app. Given that test_request_context() allows text to be printed on the terminal, which of the following statements is correct?

python
from flask import Flask, url_for
app = Flask(__name__)
@app.route('/hello')
def hello():
return 'Hello World!'
@app.route('/user/<username>')
def user(username):
return f'Welcome {username}!'
with app.test_request_context():
#== print statement ==#
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

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

  • C

Question 14

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

+4.5 marksOne correct option

Consider the schema for the Class Student.

sql
CREATE TABLE "student" (
"s_id" INTEGER,
"roll_number" TEXT NOT NULL UNIQUE,
"first_name" TEXT NOT NULL,
"last_name" TEXT NOT NULL,
PRIMARY KEY("s_id" AUTOINCREMENT)
);

What will be the output of the flask_sqlalchemy command given below?

python
>>> s1 = Student(roll_number = "M01", first_name = "John", last_name = "Dewis")
>>> db.session.add(s1)
>>> s2 = Student(roll_number = "M02", first_name = "John", last_name = "Nector")
>>> db.session.add(s2)
>>> s3 = Student(roll_number = "M03", first_name = "Nick", last_name = "Dewis")
>>> db.session.add(s3)
>>> db.session.commit()
>>> user1= Student.query.filter_by(first_name="John").first()
>>> user1.first_name= "Nick"
>>> db.session.commit()
>>> s1 = Student.query.all()
>>> for student in s1:
print(student.first_name)
print(student.last_name)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 16

+4.5 marksOne correct option

Consider the following flask application "app.py" given below.

python
import sys
from flask import Flask, render_template
app = Flask(__name__, static_folder = 'stationary')
@app.route('/')
def func():
folder_1 = sys.argv[1]
folder_2 = sys.argv[2]
if app.static_folder == folder_1:
return f"<h1>Static folder verified: {folder_1}</h1>"
if app.static_folder == folder_2:
return f"<h1>Static folder verified: {folder_2}</h1>"
return "<h1>Invalid argument</h1>"
app.run(debug = True)

If the application is running locally on http://127.0.0.1:5000. What will be rendered by the browser for the command:
python app.py /static /stationary

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

Correct answer

  • C

Question 17

+4.5 marksOne correct option

You are given a project with three files: conftest.py, test_multiples_of_3_and_6.py, and test_multiples_of_13.py. The purpose of the tests is to verify if numbers generated by each function are divisible by 39. However, there is a setup issue in this project.

  • conftest.py contains a fixture that provides test data.
  • test_multiples_of_3_and_6.py has two functions: one checks divisibility by 3, and the other by 6.
  • test_multiples_of_13.py contains a function to check divisibility by 13.

Here is the content of each file:

conftest.py

python
import pytest
@pytest.fixture
def divisible_by_39():
return 39 # Fixture providing the number to be tested

test_multiples_of_3_and_6.py

python
import pytest
def test_divisible_by_3(divisible_by_39):
assert divisible_by_39 % 3 == 0 # Checks if divisible by 3
def test_divisible_by_6(divisible_by_39):
assert divisible_by_39 % 6 == 0 # Checks if divisible by 6

test_multiples_of_13.py

python
import pytest
def test_divisible_by_13(divisible_by_39):
assert divisible_by_39 % 13 == 0 # Checks if divisible by 13

When you run pytest -k divisible , which of the following is true?

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

Correct answer

  • A

Question 18

+4.5 marksOne correct option

A client machine and a server machine located 120 kilometers apart start moving towards each other along a straight line at 400 kmph and 800 kmph respectively. At the same time, the client starts sending requests to the server and the server sends back the response to the client. This client-server network continues to send requests and receive responses (with a new request being sent only after the response is received by the client for the previous one) until both the server and the client collide with each other. Calculate the total distance travelled (in kms) by the request data and the response data together before the two machines collide with each other?(assume the speed of request and response to be 3 x 10⁸m/s )

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

Correct answer

  • D

Question 19

+2 marksOne or more correct options

Which of the following are benefits of using the MVC (Model-View-Controller) architecture?

Select all that apply.

  1. A

    MVC allows for the implementation of multiple views of the same data concurrently.

  2. B

    MVC supports parallel development, enabling developers to work on different parts of the application simultaneously.

  3. C

    MVC enforces the use of View State, increasing the bandwidth of requests.

  4. D

    MVC is a heavyweight framework that requires significant bandwidth due to its design.

Show answer

Correct answers

  • A

    MVC allows for the implementation of multiple views of the same data concurrently.

  • B

    MVC supports parallel development, enabling developers to work on different parts of the application simultaneously.

Question 20

+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)
==Missing code here===

Which of the following statement(s) should replace ==Missing code here=== so that it 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 21

+3 marksOne or more correct options

Which of the following statements about server architectures, Apache and Nginx, is/are correct?

Select all that apply.

  1. A

    Apache is better suited for handling a large volume of concurrent connections than Nginx.

  2. B

    Apache is versatile and supports a wide range of modules and dynamic configurations.

  3. C

    Nginx is generally faster for serving static files and handling high traffic with low memory usage.

  4. D

    Both Apache and Nginx are open-source web servers.

Show answer

Correct answers

  • B

    Apache is versatile and supports a wide range of modules and dynamic configurations.

  • C

    Nginx is generally faster for serving static files and handling high traffic with low memory usage.

  • D

    Both Apache and Nginx are open-source web servers.

Question 22

+3 marksOne or more correct options

Consider the following route in the flask for a signup page and select the correct option:

python
@app.route('/signup', methods=['GET', 'POST'])
def signup():
if request.method == 'GET':
return """<form action='/signup' method='POST'>
<label for='username'>Username</label>
<input type='text' name='username' required>
<label for='password'>Password</label>
<input type='text' name='password' required minlength="8">
<input type='submit' value='Submit'>
</form>
"""
if request.method == 'POST':
if request.form.get('username') is None:
return redirect(url_for(signup))
if request.form.get('password') is None:
return redirect(url_for(signup))
if len(request.form.get('password')) < 8:
return redirect(url_for(signup))
return f"<h1>Welcome, {request.form.get('username')}!</h1>"

Select all that apply.

  1. A

    The signup page is dynamically generated.

  2. B

    The signup page uses server-side rendering.

  3. C

    The signup page uses frontend validation.

  4. D

    The signup page uses backend validation.

Show answer

Correct answers

  • A

    The signup page is dynamically generated.

  • B

    The signup page uses server-side rendering.

  • C

    The signup page uses frontend validation.

  • D

    The signup page uses backend validation.

Question 23

+3 marksOne or more correct options

Consider the following HTML code.

Select all that apply.

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

Correct answers

  • C
  • D

Question 24

+4.5 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 25

+4.5 marksOne or more correct options

Consider the following Jinja2 templating code:

python
from jinja2 import Template
template_str = """
{% set gifts = [
{'name': 'Teddy Bear', 'price': 250, 'rating': 4.2},
{'name': 'Coffee Mug', 'price': 150, 'rating': 4.5},
{'name': 'Keychain', 'price': 100, 'rating': 3.9},
{'name': 'Notebook', 'price': 180, 'rating': 4.7},
{'name': 'Wall Clock', 'price': 300, 'rating': 4.0}
] %}
<ul>
{% for gift in gifts if gift.price < 200 and gift.rating > 4 %}
<li>{{ gift.name }} - {{ gift.price }} - {{ gift.rating }}</li>
{% endfor %}
</ul>
"""
template = Template(template_str)
rendered_str = template.render()
print(rendered_str)

Will the above Jinja templating code return the correct output? If yes, what will be the result?

Select all that apply.

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

Correct answer

  • C

Question 26

+4.5 marksOne or more correct options

The following Flask-RESTful API code snippet is intended to create a RESTful API for managing student registrations in an IITM BS degree program. However, there is an error in the code that prevents it from functioning correctly.

python
from flask import Flask, jsonify, request
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
students = []
class Student(Resource):
def get(self, student_id):
for student in students:
if student["id"] == student_id:
return jsonify(student)
return jsonify({"message": "Student not found"}), 404
def post(self):
data = request.get_json()
new_student = {
"id": data["id"],
"name": data["name"]
}
students.append(new_student)
return jsonify({"message": "Student added successfully"})
api.add_resource(Student, "/student/<int:student_id>")
if __name__ == "__main__":
app.run(debug=True)

Error:
When trying to use the POST method to add a student, it throws a TypeError stating that the route does not match the method. Identify the correct option to fix the error in the code.

Select all that apply.

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

Correct answers

  • C
  • D

Question 27

+2 marksOne correct option

IITM BS degree program conducts an annual event called Paradox every summer. The event is open to students, and participants are assigned to hostels based on availability. Each student can stay in only one hostel, but a hostel can accommodate multiple students. Additionally, each student can register for multiple events at Paradox, and each event can have multiple registered students. To model this in SQLAlchemy ORM, we need to establish relationships between the Student, Hostel, and Event tables.

Based on the above data, answer the given subquestions.

Which type of relationship best represents the association between students and hostels in the given scenario?

  1. A

    One-to-One

  2. B

    One-to-Many

  3. C

    Many-to-One

  4. D

    Many-to-Many

Show answer

Correct answer

  • C

    Many-to-One

Question 28

+3 marksOne correct option

IITM BS degree program conducts an annual event called Paradox every summer. The event is open to students, and participants are assigned to hostels based on availability. Each student can stay in only one hostel, but a hostel can accommodate multiple students. Additionally, each student can register for multiple events at Paradox, and each event can have multiple registered students. To model this in SQLAlchemy ORM, we need to establish relationships between the Student, Hostel, and Event tables.

Based on the above data, answer the given subquestions.

Which SQLAlchemy relationship should be used to model the many-to-many relationship between students and events in the Paradox ?

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

Correct answer

  • C

Question 29

+2 marksOne correct option

The students of IITM BS challenged their instructors to a cricket match. A Flask web application is built to track the scores. Below is the Flask app code that defines multiple routes for fetching scores dynamically.

python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return "Welcome to the IITM BS Cricket Match Scoreboard!"
@app.route('/score/<team>')
def team_score(team):
scores = {"students": 120, "instructors": 115}
return f"{team.capitalize()} Score: {scores.get(team, 'Team not found')}"
@app.route('/score/<team>/<player>')
def player_score(team, player):
players = {
"students": {"Rahul": 45, "Ananya": 30, "Karthik": 25},
"instructors": {"Prof.Prashant": 40, "Prof.Mayur": 35, "Dr.Subendu": 20}
}
return f"{player} ({team.capitalize()}) Scored: {players.get(team, {}).get(player, 'Player not found')}"
if __name__ == "__main__":
app.run(debug=True)

Based on the above data, answer the given subquestions.

What will be the output when the following URL is accessed?

  1. A

    Score: students

  2. B

    Students Score: 120

  3. C

    None of these

  4. D

    Team not found

Show answer

Correct answer

  • B

    Students Score: 120

Question 30

+4.5 marksOne correct option

The students of IITM BS challenged their instructors to a cricket match. A Flask web application is built to track the scores. Below is the Flask app code that defines multiple routes for fetching scores dynamically.

python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return "Welcome to the IITM BS Cricket Match Scoreboard!"
@app.route('/score/<team>')
def team_score(team):
scores = {"students": 120, "instructors": 115}
return f"{team.capitalize()} Score: {scores.get(team, 'Team not found')}"
@app.route('/score/<team>/<player>')
def player_score(team, player):
players = {
"students": {"Rahul": 45, "Ananya": 30, "Karthik": 25},
"instructors": {"Prof.Prashant": 40, "Prof.Mayur": 35, "Dr.Subendu": 20}
}
return f"{player} ({team.capitalize()}) Scored: {players.get(team, {}).get(player, 'Player not found')}"
if __name__ == "__main__":
app.run(debug=True)

Based on the above data, answer the given subquestions.

What will happen if we access the following URL?

  1. A

    Dr.Prashant (Instructors) Scored: 40

  2. B

    Player not found

  3. C

    Internal Server Error

  4. D

    Dr.Prashant (Instructors) Scored: Player not found

Show answer

Correct answer

  • D

    Dr.Prashant (Instructors) Scored: Player not found

Question 31

+2 marksOne correct option

A college counseling system is designed to store and retrieve student records efficiently. The system uses different types of storage based on latency, throughput, and density. During peak counseling sessions, thousands of students access their academic records, appointment schedules, and previous counseling notes. The system needs to optimize storage selection for different types of data:
1. Frequently accessed small data (e.g., currently active student records)
2. Large archives of past counseling records (rarely accessed but need long-term storage) 3. Temporary session data that needs to be quickly read and updated during counseling sessions Based on the above data, answer the given subquestions.

Which of the following storage types should be used for storing frequently accessed small student records that need low latency and high-speed access?

  1. A

    Hard Disk Drive (HDD)

  2. B

    Solid State Drive (SSD)

  3. C

    Registers

  4. D

    Static RAM (SRAM)

Show answer

Correct answer

  • D

    Static RAM (SRAM)

Question 32

+2 marksOne correct option

A college counseling system is designed to store and retrieve student records efficiently. The system uses different types of storage based on latency, throughput, and density. During peak counseling sessions, thousands of students access their academic records, appointment schedules, and previous counseling notes. The system needs to optimize storage selection for different types of data:
1. Frequently accessed small data (e.g., currently active student records)
2. Large archives of past counseling records (rarely accessed but need long-term storage) 3. Temporary session data that needs to be quickly read and updated during counseling sessions Based on the above data, answer the given subquestions.

The college wants to store archived counseling records from past students for future reference. These records are rarely accessed, but cost efficiency and storage density are important. Which storage type is best suited?

  1. A

    Registers

  2. B

    SRAM

  3. C

    Hard Disk Drive (HDD)

  4. D

    DRAM

Show answer

Correct answer

  • C

    Hard Disk Drive (HDD)