uiz Space

May 2024 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 1: 7 July 2024 (May 2024 term)

The IIT Madras BS Modern Application Development I (MAD 1) Quiz 1 paper sat on 7 Jul 2024, in the May 2024 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 7 July 2024 · No negative marking.

Question 1

+2 marksOne correct option

Which of the following is not a correct perceivable accessibility principle?

  1. A

    Provide text alternatives for non-text content.

  2. B

    Provide captions and other alternatives for multimedia.

  3. C

    Make it easier for users to see and hear content.

  4. D

    Give users enough time to read and use content.

Show answer

Correct answer

  • D

    Give users enough time to read and use content.

Question 2

+2 marksOne correct option

Which of the below HTTP status codes represents the client error?

  1. A

    500-599

  2. B

    400-499

  3. C

    300-399

  4. D

    200-299

  5. E

    100-199

Show answer

Correct answer

  • B

    400-499

Question 3

+2 marksOne correct option

What will be the output of the following Python code?

python
from jinja2 import Template
data = {"id": 101, "prod_name": "Groceries", "sales_amt": 5600,
"sales_bonus": 5}
def foo(amount, p):
return amount * p / 100
a = foo(data["sales_amt"], data["sales_bonus"])
t = Template(
"Congratulations, you got bonus {{ bonus }} by selling product
{{data['prod_name']}}"
)
output = t.render(data=data, bonus=a)
print(output)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 4

+2 marksOne correct option

Consider the below table.

Use the above table. Which of the below match is correct?

  1. A

    i - d, ii - b, iii - a, iv - e, v - c

  2. B

    i - d, ii - c, iii - e, iv - a, v - b

  3. C

    i - c, ii - d, iv - e, iii - a, v - b

  4. D

    i - c, ii - d, iv - e, iii - b, v - a

Show answer

Correct answer

  • B

    i - d, ii - c, iii - e, iv - a, v - b

Question 5

+3 marksOne correct option

A certain movie with advertisements is being streamed by the client on the internet with a bandwidth of 5 Mbps. If the total data consumed only in the advertisements is 340 MB and the advertisements comprises 17% of the total duration of the streamed movie, what can be the size of the entire movie (in Megabytes) including the advertisements?

  1. A

    20

  2. B

    640

  3. C

    2000

  4. D

    1660

Show answer

Correct answer

  • C

    2000

Question 6

+3 marksOne correct option
  1. A

    0 bits

  2. B

    1000 bits

  3. C

    4000 bits

  4. D

    5000 bits

Show answer

Correct answer

  • B

    1000 bits

Question 7

+3 marksOne correct option

The following Python code snippet generates the output on the terminal.

python
from string import Template
s = Template('$name studies at $university')
b = {'name': 'Bob'}
out1 = Template('$name studies $subject').safe_substitute(b)
print(out1)
out2 = s.substitute(name='Alice', university='Oxford')
print(out2)
out3 = Template('$name studies $subject').substitute(b)
print(out3)

Which of the following is the correct output?

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

Correct answer

  • B

Question 8

+3 marksOne correct option

Consider the following HTML document.

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Span</title>
<style>
span{
color: blue;
Background-color: lime;
}
</style>
</head>
<body>
<span id="my_span">MAD-I is a Diploma level course.</span>
<span>SE is a Degree level course.</span>
</body>
</html>

What will be the rendered output if an additional style is added via the ID selector given below?

css
#my_span{
width: 1200px;
Background-color: lightpink;
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 9

+3 marksOne correct option

Consider the following Python code snippet.

Filename: app.py

python
from flask import Flask, request
import sys
app = Flask(__name__)
@app.route('/home', methods = sys.argv)
def my_func():
if request.method == 'GET':
return f"Hello from {sys.argv[1]} method"
elif request.method == 'POST':
return f"Hello from {sys.argv[2]} method"
else:
return "Please enter a valid HTTP method"
app.run(debug = True)

If the above flask app is run using the command python app.py POST GET in one terminal, what will be the output on another terminal for command;
curl -X POST http://127.0.0.1:5000/home ?

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

Correct answer

  • B

Question 10

+3 marksOne correct option

Consider the following Python code snippet.

Filename: module.py

python
from pyhtml import *
import sys
var = sys.argv[1:]
def list_func(stack):
for tech in stack:
yield span(tech)
doc = html(
head(title('My Document')),
body(
h3('Frontend technologies'),
list_func(var[::-1])
)
)
print(doc.render())

How will the browser render the output of the above code if it is run on the terminal using the command python module.py HTML CSS JS VUE?

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

Correct answer

  • B

Question 11

+4.5 marksOne correct option

Consider the following HTML document.

html
<!DOCTYPE html>
<html>
<head>
<style>
span {
background-color: lightgray;
color: red;
font-weight: bold;
}
div{
border: 3px solid purple;
text-align: center;
width:20%;
}
#id1 {
color:blue ;
}
#id2 {
display: block;
}
.class1 {
background-color: lightgreen;
color: blue;
display: inline-block;
}
.class2 {
background-color: skyblue;
color: red;
}
</style>
</head>
<body>
<div>
<span class="class1" id="id1">Content 1</span>
<span class="class2 class1" >Content 2</span>
<span id="id2">Content 3</span>
</div>
</body>
</html>

How will the browser render above HTML file?

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

Correct answer

  • C

Question 12

+4.5 marksOne correct option

Consider a client A that makes a request to server B that fetches the information from Datacenter C which in turn fetches other required information from the Datacenter D. The distance between the client A, server B and datacenters C and D within the network and the speed of information in the medium connecting these nodes is mentioned in the table below.

Calculate the round trip latency (in milliseconds) of the network?

  1. A

    187

  2. B

    132.5

  3. C

    265

  4. D

    150

Show answer

Correct answer

  • C

    265

Question 13

+4.5 marksOne correct option

Consider the following flask app and the bodies of two index.html files shown in the figure below.

app.py

python
from flask import Flask, render_template
import sys
app = ========= app object initialization here ===========
@app.route('/home')
def home():
return render_template('index.html')
app.run()

app_templates/index.html

html
<h3>Home page</h3>
<p>MAD I focuses on backend development</p>
<h5>IITM ONLINE DEGREE</h5>

root_templates/index.html

html
<h3>Home page</h3>
<p>Vue JS is a frontend technology</p>
<h5>IITM BS DEGREE</h5>

If the app is run locally using the command
python app.py root_templates app_templates,
and the output on browser for URL http://127.0.0.1/home is:

Home page

Vue JS is a frontend technology

IITM BS DEGREE

How should the app be initialized to get the desired output on the browser?

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

Correct answer

  • D

Question 14

+3 marksOne or more correct options

What can be inferred from the Entity-Relationship Diagram below:

Select all that apply.

  1. A

    A student can exist without enrolling to any course

  2. B

    A student can have more than one courses

  3. C

    A student needs to have at least one course

  4. D

    A course must belong to one and only one student

Show answer

Correct answers

  • A

    A student can exist without enrolling to any course

  • B

    A student can have more than one courses

Question 15

+3 marksOne or more correct options

Consider the following Flask code.

File name: sum_args.py

python
import sys
from flask import Flask
app = Flask(__name__)
def do_something():
if len(sys.argv) >= 2:
l = []
for i in range(1, len(sys.argv)):
l.append(int(sys.argv[i]))
return l
else:
return None
@app.route("/")
def do_sum():
result = do_something()
if result:
s = 0
for e in result:
s += int(e)
return f"<h2>Sum is : {s}"
else:
return f"<h2>Sum is : {result}"
app.run(debug=True)

Select the command(s) to execute the above code without any error.

Select all that apply.

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

Correct answers

  • A
  • B
  • C

Question 16

+4.5 marksOne or more correct options

Consider the following Python code and HTML document.

python
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/font/size/<int:size>")
def font_size(size):
internal_css = {}
if size < 12:
internal_css = {"font-weight": "bold", "font-size": "12px"}
else:
internal_css = {"font-weight": "normal", "font-size": str(size) + "px"}
return render_template("index.html", internal_css=internal_css)
app.run(debug=True)

HTML document: templates/index.html

html
<!DOCTYPE html>
<html>
<div style="font-size:{{internal_css['font-size']}};
font-weight:{{internal_css['font-weight']}};">
IITM BS Degree Program
</div>
</html>

Assume that the flask server is running on “http://localhost:5000/”. Which of the following is/are true?

Select all that apply.

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

Correct answers

  • A
  • C
  • D