uiz Space

January 2025 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 1: 23 February 2025 (January 2025 term)

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 23 Feb 2025, in the January 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
MSQ
3

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 23 Feb 2025 · No negative marking.

Question 1

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

Correct answer

  • B

Question 2

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

Correct answer

  • B

Question 3

+2 marksOne correct option

Read the statements given below carefully and select the correct option.
Statement 1: If an element that belongs to two different classes is styled externally using both the classes, then for the same attribute, it will acquire styling from the latest class in order. Statement 2: If an element having an ID and a class is styled externally using both its ID and the class, then for the same attribute, it will acquire styling from the ID selector.

  1. A

    Both statements 1 and 2 are correct

  2. B

    Both statements 1 and 2 are incorrect

  3. C

    Statement 1 is correct but statement 2 is incorrect

  4. D

    Statement 2 is correct but statement 1 is incorrect

Show answer

Correct answer

  • A

    Both statements 1 and 2 are correct

Question 4

+2 marksOne or more correct options

Which of the following options represents a one-to-one relationship in the Entity-Relationship Diagram?

Select all that apply.

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

Correct answers

  • A
  • B

Question 5

+3 marksOne correct option

Consider the following HTML document:

html
<!DOCTYPE html>
<html lang="en">
<head>
<style>
#container {
border-style: dashed;
background-color: red;
}
.content {
border-style: solid;
border-color: green;
background-color: orange;
}
div {
width: 250px;
border: 3px dotted black;
border-color: yellow;
}
</style>
</head>
<body>
<div id="container" class="content" style="background-color: yellow;">
<h2>Welcome to Web Dev</h2>
</div>
</body>
</html>

How will the browser render the above HTML document?

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

Correct answer

  • A

Question 6

+3 marksOne correct option

Consider the following HTML code:

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
div {
color: blue;
}
#s1 {
color: yellow;
}
.s2{
color: green;
}
h3{
color: red;
}
</style>
</head>
<body>
<div class="s2" id="s1"><h3>IITM Online BS Degree Program</h3></div>
</body>
</html>

What is the colour of the printed text “IITM Online BS Degree Program”?

  1. A

    BLUE

  2. B

    YELLOW

  3. C

    GREEN

  4. D

    RED

Show answer

Correct answer

  • D

    RED

Question 7

+3 marksOne correct option

Consider the template code and Python code given below:

Template code: “output.html”

html
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<ol>
{%for p in products%}
{%if "i" in p.name|string %}
<li>{{p.id}}, {{p.name}}, {{p.qty}}, {{p.price}}</li>
{%endif%}
{%endfor%}
</ol>
</body>
</html>

Python code: “main.py”

python
from jinja2 import Template
products = [
{"id": "101", "name": "Food", "qty": 78, "price": 100},
{"id": "102", "name": "Electrical", "qty": 4, "price": 16},
{"id": "103", "name": "Stationary", "qty": 7, "price": 14},
{"id": "104", "name": "Electronics", "qty": 10, "price": 145},
]
with open("output.html") as r:
t = Template(r.read())
print(t.render(products=products))

What will the output of the above Python code be?

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

Correct answer

  • B

Question 8

+3 marksOne correct option

Consider the following Python code snippet:

Python code: “main.py”

python
import sys
movie_ratings = {
"Kalki": [5, 1, 2, 1, 1],
"Jailer": [7, 3, 1, 2, 1],
"Leo": [4, 3, 2, 2, 1],
}
def do_something(movie_name):
avg_ratings = {}
for movie in movie_ratings:
if movie == movie_name:
avg_ratings[movie] = sum(movie_ratings[movie]) /
len(movie_ratings[movie])
return avg_ratings
return "Movie not found"
args = sys.argv
print(do_something(args[1]))

The above file will result in the output as “2.8”, for which of the following command line input?

  1. A

    python main.py Kalki

  2. B

    python main.py Leo

  3. C

    python main.py Pushpa2

  4. D

    python main.py Jailer

Show answer

Correct answer

  • D

    python main.py Jailer

Question 9

+3 marksOne correct option

Consider two python files, mad1.py and mad2.py with following code snippets.

File1: mad1.py

python
import sys
import mad2
print('Welcome' + ' ' + sys.argv[1])

File2: mad2.py

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

What is the output of the following command “python mad1.py mad2.py MAD-I MAD-II”?

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

Correct answer

  • C

Question 10

+3 marksOne or more correct options

Select all that apply.

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

Correct answers

  • A
  • B
  • D

Question 11

+3 marksOne or more correct options

Select all that apply.

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

Correct answers

  • B
  • D

Question 12

+4.5 marksOne correct option

A server S requests to retrieve data from two data centers DC1DC_1 and DC2DC_2, which are located at distances of D1D_1 and D2D_2 meters respectively from the server S. The speed of data travelling through the medium that connects S with DC1DC_1 is m1m_1 m/sec and that connects S with DC2DC_2 is m2m_2 m/sec. With the given media for data transfer between S →DC1\rightarrow DC_1 and S →DC2\rightarrow DC_2, it takes an additional 200 milliseconds for the data to reach S from DC2DC_2 than it takes from DC1DC_1 if the complete response is ready only when the data is available to S from both the datacenters. Figure out the value of m2m_2 (in m/sec) in terms of D1D_1, D2D_2 and m1m_1. [Note: The data centers send responses only when they receive a request from the server]

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

Correct answer

  • D

Question 13

+4.5 marksOne correct option

Consider two fictitious addressing systems, IPv5 and IPv8, used to store the IP address of a machine. Following are the forms of storing addresses for each system.

IPv5: It is a 45-bit long address denoted by 5 sets of 3-digit octal numbers separated by a hyphen (-).
e.g. xxx - xxx - xxx - xxx - xxx

IPv8: It is a 64-bit long address denoted by 4 sets of 4-bit hexadecimal numbers separated by colon (:)
e.g. xxxx:xxxx:xxxx:xxxx

How would an IPv5 address, 145-123-010-235-453 be represented in IPv8 format based on information given above?

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

Correct answer

  • C

Question 14

+4.5 marksOne correct option

Consider the following code:

python
import pyhtml as html
table = {'table': [[1,2,3],[4,5,6]]}
def f_table(ctx):
template_str = html.html(
html.head(
html.title('Title')
),
html.body(
html.table(
(html.tr(
[html.td(cell) for cell in row]
) for row in ctx['table'])
)
)
)
return (template_str)
template = f_table(table)
print(template.render())

What will the output of the above PyHTML code be?

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

Correct answer

  • A

Question 15

+3 marksOne correct option

app.py

python
import sys
from string import Template as T1
from jinja2 import Template as T2
temp = "The book title is $title and it costs {{price}}."
if sys.argv[1] == 'jinja 2':
temp = T1(temp)
out = temp.substitute({'title': 'Python Basics', 'price': '$20'})
elif sys.argv[1] == 'string':
temp = T2(temp)
out = temp.render({'title': 'Python Basics', 'price': '$20'})
else:
out = 'Invalid input'
print(out)

Based on the above program, answer the given subquestions.

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

Correct answer

  • B

Question 16

+4.5 marksOne correct option

app.py

python
import sys
from string import Template as T1
from jinja2 import Template as T2
temp = "The book title is $title and it costs {{price}}."
if sys.argv[1] == 'jinja 2':
temp = T1(temp)
out = temp.substitute({'title': 'Python Basics', 'price': '$20'})
elif sys.argv[1] == 'string':
temp = T2(temp)
out = temp.render({'title': 'Python Basics', 'price': '$20'})
else:
out = 'Invalid input'
print(out)

Based on the above program, answer the given subquestions.

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

Correct answer

  • D