
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.
- 16
- 50
- 120 min
- 13
- 3
Show answer
Correct answer
Question 2
Show answer
Correct answer
Question 3
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.
Both statements 1 and 2 are correct
Both statements 1 and 2 are incorrect
Statement 1 is correct but statement 2 is incorrect
Statement 2 is correct but statement 1 is incorrect
Show answer
Correct answer
Both statements 1 and 2 are correct
Question 4
Which of the following options represents a one-to-one relationship in the Entity-Relationship Diagram?
Show answer
Correct answers
Question 5
Consider the following HTML document:
<!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?
Show answer
Correct answer
Question 6
Consider the following HTML code:
<!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”?
BLUE
YELLOW
GREEN
RED
Show answer
Correct answer
RED
Question 7
Consider the template code and Python code given below:
Template code: “output.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”
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?
Show answer
Correct answer
Question 8
Consider the following Python code snippet:
Python code: “main.py”
import sysmovie_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.argvprint(do_something(args[1]))The above file will result in the output as “2.8”, for which of the following command line input?
python main.py Kalki
python main.py Leo
python main.py Pushpa2
python main.py Jailer
Show answer
Correct answer
python main.py Jailer
Question 9
Consider two python files, mad1.py and mad2.py with following code snippets.
File1: mad1.py
import sysimport mad2print('Welcome' + ' ' + sys.argv[1])File2: mad2.py
import sysprint('Welcome' + ' ' + sys.argv[0])What is the output of the following command “python mad1.py mad2.py MAD-I MAD-II”?
Show answer
Correct answer
Question 10
Show answer
Correct answers
Question 11
Show answer
Correct answers
Question 12
A server S requests to retrieve data from two data centers and , which are located at distances of and meters respectively from the server S. The speed of data travelling through the medium that connects S with is m/sec and that connects S with is m/sec. With the given media for data transfer between S and S , it takes an additional 200 milliseconds for the data to reach S from than it takes from if the complete response is ready only when the data is available to S from both the datacenters. Figure out the value of (in m/sec) in terms of , and . [Note: The data centers send responses only when they receive a request from the server]
Show answer
Correct answer
Question 13
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?
Show answer
Correct answer
Question 14
Consider the following code:
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?
Show answer
Correct answer
Question 15
app.py
import sysfrom string import Template as T1from 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.
Show answer
Correct answer
Question 16
app.py
import sysfrom string import Template as T1from 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.
Show answer
Correct answer