uiz Space

September 2024 term · Modern Application Development I · BSCS2003

Modern Application Development I Quiz 1: 27 October 2024 (September 2024 term)

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

Question 1

+2 marksOne correct option

Suppose a Gamer wants to buy a Bluetooth earphone which can give him a good gaming experience, for that the delay between the action that happens in his phone and the sound heard by him for that action should be as low as possible so that he can play well. Following this scenario, which of the following option(s) is/are correct?

  1. A

    He should buy the earphones which have high latency as much possible.

  2. B

    It all depends on Internet Speed, so we can’t determine anything.

  3. C

    He should buy the earphones which have low latency as much possible.

  4. D

    He should buy the earphones which have as low Bluetooth version as possible.

Show answer

Correct answer

  • C

    He should buy the earphones which have low latency as much possible.

Question 2

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

Correct answer

  • B

Question 3

+3 marksOne correct option

Consider the following HTML code and select the correct rendered output from the following.

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<table border="2">
<tr>
<th>One</th>
<td>Four</td>
</tr>
<tr>
<th> Two</th>
<td> Three</td>
</tr>
</table>
</body>
</html>
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 4

+3 marksOne correct option

Consider the following code block and select the correct option regarding the output when we run the python file app.py.

app.py

python
from jinja2 import Template
template='''
Welcome to {Degree} DEGREE
First level to clear is {{level}}
'''
rendered=Template(template)
output=rendered.render(Degree="IITM BS",level="Foundation")
print(output)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 5

+3 marksOne correct option

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

python
from string import Template
greet_template = Template('Hello, $name! Welcome to $place.')
greeting1 = greet_template.substitute(name='Alice', place='Wonderland')
print(greeting1)
data = dict(name='Bob')
greeting2 = greet_template.safe_substitute(data)
print(greeting2)
greeting3 = greet_template.substitute(data)
print(greeting3)

Which of the following is the correct output?

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

Correct answer

  • D

Question 6

+3 marksOne correct option

The directory listing of a folder and the content of each of its files are given below.

Directory Listing:

text
my_dir-|
|-- base.html
|-- home.html
|-- index.html

Filename: base.html

html
<body>
<h1>Welcome to MAD-I course</h1>
</body>

Filename: home.html

html
<body>
<h1>Welcome to PDSA course</h1>
</body>

Filename: index.html

html
<body>
<h1>Welcome to DBMS course</h1>
</body>

If a simple Python HTTP server is created for this directory, what will be rendered on the browser for base URL?

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

Correct answer

  • B

Question 7

+3 marksOne correct option

Consider the following Python code and select correct output.

python
from jinja2 import Template
class Loan:
def __init__(self, accno, loan_amount, interest_rate):
self.accno = accno
self.loan_amount = loan_amount
self.interest_rate = interest_rate
def get_loan_details(self):
return (self.accno, self.loan_amount, self.interest_rate)
loan1 = Loan(101, 45900, 5)
loan2 = Loan(102, 170000, 6)
tm1 = Template("Account1 : {{l1.get_loan_details()}}")
tm2 = Template("Account2 : {{l2.get_loan_details()}}")
print(tm1.render(l1=loan1))
print(tm2.render(l2=loan2))
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 8

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

Correct answer

  • D

Question 9

+4.5 marksOne correct option

A certain network connection with a bandwidth of 10 Mbps allows making 1000 requests to a server per second. If each request is modified to have an additional data of 8 Kb, what should be the additional bandwidth required to maintain the rate of 2000 requests per second?

  1. A

    18 Mbps

  2. B

    16 Mbps

  3. C

    26 Mbps

  4. D

    36 Mbps

Show answer

Correct answer

  • C

    26 Mbps

Question 10

+4.5 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 "<h1>Hello from POST</h1>"
elif request.method == 'POST':
return "<h1>Hello from GET</h1>"
else:
return "<h1>Please enter a valid HTTP method<h1>"
app.run(debug = True)

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

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

Correct answer

  • B

Question 11

+4.5 marksOne correct option
  1. A

    Increase

  2. B

    Decrease

  3. C

    Remain Same

  4. D

    Insufficient Information

Show answer

Correct answer

  • C

    Remain Same

Question 12

+2 marksOne or more correct options

Select all that apply.

  1. A

    HTTP/2.0 is the protocol and version respectively

  2. B

    500 is the port number

  3. C

    “Internal Server Error” is the status message

  4. D

    500 is the status code

  5. E

    HTTP/2.0 is the server failure

Show answer

Correct answers

  • A

    HTTP/2.0 is the protocol and version respectively

  • C

    “Internal Server Error” is the status message

  • D

    500 is the status code

Question 13

+2 marksOne or more correct options

Consider the flask code below.

python
from flask import Flask
app = Flask(__name__)
@app.route("/employee/<id>")
def get_employee(id):
return "Employee id : " + str(id)
if __name__ == "__main__":
app.run(debug=True)

Assume that the above flask application is running on http://127.0.0.1:5000 . Which of the following URLs will render “Not Found” error?

Select all that apply.

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

Correct answers

  • C
  • D

Question 14

+4.5 marksOne or more correct options

Consider the following code snippet.

python
@app.route('/name/<type>')
def prod_detail(type):
# CODE BLOCK HERE

Assume the database has a "product" table represented by class "Product" which has a TEXT column "type". If we want the server to return a 404 status code when a user goes to the route '/name/<type>' with a “type” that does not exist in the database, which of the following lines would give us the desired output?

Select all that apply.

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

Correct answers

  • B
  • C
  • D

Question 15

+3 marksOne correct option

Consider the following code and answer the given subquestions.

form.html

html
<!DOCTYPE html>
<body>
<form method=Method>
Enter Your Name : <input type="text" name="name">
<button>Submit</button>
</form>
</body>
</html>

app.py

python
from flask import Flask
from flask import render_template, request
app=Flask(__name__)
@app.route("/",methods=['GET','POST'])
def home():
if request.method=="GET":
return render_template("form.html")
else:
return render_template("home.html")
app.run(debug=True)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 16

+3 marksOne correct option

Consider the following code and answer the given subquestions.

form.html

html
<!DOCTYPE html>
<body>
<form method=Method>
Enter Your Name : <input type="text" name="name">
<button>Submit</button>
</form>
</body>
</html>

app.py

python
from flask import Flask
from flask import render_template, request
app=Flask(__name__)
@app.route("/",methods=['GET','POST'])
def home():
if request.method=="GET":
return render_template("form.html")
else:
return render_template("home.html")
app.run(debug=True)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D