Quiz Space

January 2023 term · Modern Application Development I · BSCS2003

MAD 1 End Term: 30 April 2023, Set QPD1-S2 (January 2023 term)

The IIT Madras BS Modern Application Development I (MAD 1) End Term paper sat on 30 Apr 2023, in the January 2023 term, set QPD1-S2: 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
26
MSQ
6

Updated

Official paper: IIT M DIPLOMA ET1 EXAM QPD1 S2 30 Apr 2023 · 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

  • C

Question 3

+2 marksOne correct option

Consider the following two statements and select the correct option.
Statement 1: Server-level logging can only indicate which URLs were accessed
Statement 2: Server-level logging can indicate if large number of requests were made in a short duration of time such as in DDoS attacks

  1. A

    Statement 1 is true, while statement 2 is false

  2. B

    Statement 2 is true, while statement 1 is false

  3. C

    Both statements 1 and 2 are correct

  4. D

    Both statements 1 and 2 are incorrect

Show answer

Correct answer

  • C

    Both statements 1 and 2 are correct

Question 4

+2 marksOne correct option

Consider the following statements about HTML4 and HTML5 and select the correct option. Statement 1: The HTML gets separated out from SGML from its fourth version, HTML4. Statement 2: HTML5 has additional support for latest features like multimedia support, canvases etc. and it has its own parsing rules.

  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

  • D

    Statement 2 is correct but statement 1 is incorrect.

Question 5

+2 marksOne correct option

Consider the following statements and select the correct option.
Statement 1: Replication is used to improve performance and decrease server load.
Statement 2: Redundancy ensures data is not lost if a copy gets destroyed.

  1. A

    Statement 1 is true & statement 2 is false

  2. B

    Statement 2 is true & statement 1 is false

  3. C

    Both statements 1 and 2 are true

  4. D

    Both statements 1 and 2 are false

Show answer

Correct answer

  • C

    Both statements 1 and 2 are true

Question 6

+2 marksOne correct option

Read the following statements regarding web accessibility principles and choose the correct option.
Statement 1: Understandable information and users interface helps developers to avoid and correct mistakes in their content.
Statement 2: Perceivable information ensures that the content does not cause any seizures and physical reaction to its users.

  1. A

    Both statement 1 and statement 2 are correct.

  2. B

    Both statement 1 and statement 2 are incorrect

  3. C

    Statement 1 is correct but statement 2 is incorrect

  4. D

    Statement 1 is incorrect but statement 2 is correct

Show answer

Correct answer

  • C

    Statement 1 is correct but statement 2 is incorrect

Question 7

+2 marksOne correct option
  1. A

    1-C, 2-D, 3-A, 4-B

  2. B

    1-C, 2-A, 3-D, 4-B

  3. C

    1-B, 2-A, 3-D, 4-C

  4. D

    1-A, 2-D, 3-B, 4-C

Show answer

Correct answer

  • B

    1-C, 2-A, 3-D, 4-B

Question 8

+3 marksOne or more correct options

Select all that apply.

  1. A

    A customer can exist without having any orders

  2. B

    An order can exist without belonging to any customer

  3. C

    A customer needs to have at least one order

  4. D

    An order must belong to one and only one customer

Show answer

Correct answers

  • A

    A customer can exist without having any orders

  • D

    An order must belong to one and only one customer

Question 9

+3 marksOne or more correct options

Consider the following code snippet.

python
@app.route('/user/<username>')
def profile(username):
# CODE BLOCK HERE

Assume the database has a "User" table which has a TEXT column "username". If we want the server to return a 404 status code when a user goes to the route '/user/<username>' with a username 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

  • A
  • C
  • D

Question 10

+3 marksOne or more correct options

Consider the following flask application running on the base URL and is accessed through a browser. Select the correct option(s).

python
from flask import Flask, abort, request
app = Flask(__name__)
users = {
1 : {"Name": "Ritu", "role": "Admin", "access": True},
2 : {"Name": "Ramesh", "role": "User", "access": True},
3 : {"Name": "Tejas", "role": "Admin", "access": True},
4 : {"Name": "Manisha", "role": "User", "access": False}
}
@app.route('/login')
def auth():
cred = request.args
if users[int(cred["id"])].get("access"):
id = int(cred["id"])
user = users[id]
return "Welcome, "+ user.get("Name")+", you have
"+user.get("role")+" access"
else:
abort(403)
@app.errorhandler(403)
def no_access(error):
return "Looks like you are not an authorized user!"
app.run(debug = True)

Select all that apply.

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

Correct answers

  • B
  • D

Question 11

+3 marksOne or more correct options

Consider the following users list.

python
users = [{ "id":1, "name": "user_1", "role": "manager"},
{ "id":2, "name": "user_2", "role": "manager"},
{ "id":3, "name": "user_3", "role": "manager"}]

An ordered HTML list is to be created for users where every list item should have a clickable “name” attribute redirecting to the endpoint “/show_users/<id>” where “id” is the “id” attribute of the same user dictionary. The correct way of doing it with jinja and HTML is ________.

Select all that apply.

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

Correct answers

  • A
  • B
  • C
  • D

Question 12

+3 marksOne or more correct options

Consider the following code snippet.

python
def foo(x,y):
if x < 0:
y += 1
if y > 0:
x -= 1
return x + y

Test:

python
foo(-1, 1)
foo(1, -1)

Which of the following is correct regarding the coverage of the test?

Select all that apply.

  1. A

    100% statement coverage

  2. B

    100% function coverage

  3. C

    100% branch coverage

  4. D

    100% condition coverage

Show answer

Correct answers

  • A

    100% statement coverage

  • B

    100% function coverage

  • C

    100% branch coverage

Question 13

+3 marksOne correct option
  1. A

    a = 8; b = 10; c = 16;

  2. B

    a = 10; b = 2; c = 16;

  3. C

    a = 8; b = 16; c = 10;

  4. D

    a = 2; b = 16; c = 8;

Show answer

Correct answer

  • C

    a = 8; b = 16; c = 10;

Question 14

+3 marksOne correct option

Consider the following HTML file and select the correct option.

html
<!DOCTYPE html>
<html lang="en">
<body>
<table id="rows">
<tr>
<th>Name</th>
<th>City</th>
</tr>
</table>
<button onclick="perform()">action</button>
<script>
function perform(){
let row = document.createElement("tr")
let td1 = document.createElement("td")
td1.innerText = "name_1"
let td2 = document.createElement("td")
td2.innerText = "city_1"
row.appendChild(td1)
row.appendChild(td2)
let rows = document.getElementById("rows")
rows.appendChild(row)
}
</script>
</body>
</html>
  1. A

    The action button when clicked adds a new column to the table with value “city_1”.

  2. B

    The action button when clicked adds a new column to the table with value “name_1”.

  3. C

    The action button when clicked adds a new row to the table with values “name_1” in the first column and “city_1” in the second column.

  4. D

    The action button when clicked adds a new row to the table with values “city_1” in the first column and “name_1” in the second column.

Show answer

Correct answer

  • C

    The action button when clicked adds a new row to the table with values “name_1” in the first column and “city_1” in the second column.

Question 15

+3 marksOne correct option

Consider a discourse forum where a user unlocks the ability to post images once he makes more than 25 posts. What kind of access control is this?

  1. A

    Role-based access control

  2. B

    Attribute-based access control

  3. C

    Both role-based and attribute-based access control

  4. D

    None of these

Show answer

Correct answer

  • B

    Attribute-based access control

Question 16

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

Correct answer

  • D

Question 17

+3 marksOne correct option

Consider the following statements regarding Continuous Integration and Continuous Deployment and select the correct option.
Statement 1: As part of continuous integration, frequent, isolated changes are tested and reported on as soon as they are added to a larger code base.
Statement 2: When a change is made to an application, it is automatically deployed into production using a continuous deployment strategy.

  1. A

    Statement 1 and statement 2 both are correct.

  2. B

    Statement 1 and statement 2 both are incorrect.

  3. C

    Statement 1 is correct and statement 2 is incorrect.

  4. D

    Statement 1 is incorrect and statement 2 is correct.

Show answer

Correct answer

  • A

    Statement 1 and statement 2 both are correct.

Question 18

+3 marksOne correct option
  1. A

    A → 1, B → 2, C → 4, D → 3

  2. B

    A → 4, B → 3, C → 2, D → 1

  3. C

    A → 4, B → 1, C → 2, D → 3

  4. D

    A → 3, B → 2, C → 1, D → 4

Show answer

Correct answer

  • A

    A → 1, B → 2, C → 4, D → 3

Question 19

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

Correct answer

  • C

Question 20

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

Correct answer

  • A

Question 21

+3 marksOne correct option

Consider the following Python code snippet.

python
from math import factorial
def prettify(func):
def wrapper(num):
try:
return func(num)
except:
return "Please check your number!"
return wrapper
@prettify
def fact(num):
return factorial(num)
out = fact(-4)
print(out)

What will the output if the above Python code is run on the terminal?

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

Correct answer

  • C

Question 22

+3 marksOne correct option
  1. A

    Both statement 1 and statement 2 are correct

  2. B

    Both statement 1 and statement 2 are incorrect

  3. C

    Statement 1 is correct but statement 2 is incorrect

  4. D

    Statement 1 is incorrect but statement 2 is correct

Show answer

Correct answer

  • C

    Statement 1 is correct but statement 2 is incorrect

Question 23

+4.5 marksOne correct option

Consider a function remainder, and a set of test cases given below.

Filename: test_file.py

python
def remainder(numerator, denominator):
rem = numerator % denominator
return rem
def test_func0():
assert remainder(5,7) == 5
def test_function1():
assert remainder(20,4) == 3
def test_func2():
assert remainder(31,8) == 6
def test_function3():
assert remainder(2,3) == 2

What will be the output on the terminal for the command pytest test_file.py -k func ?

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

Correct answer

  • C

Question 24

+4.5 marksOne correct option

Consider the following models Library and Book corresponding to tables library and book in SQLite database.

python
class Library(db.Model):
id = db.Column(db.Integer(), primary_key = True)
name = db.Column(db.String(), unique = True)
class Book(db.Model):
id = db.Column(db.Integer(), primary_key = True)
name = db.Column(db.String(), unique = True)
library = db.Column(db.Integer(), unique = True, db.ForeignKey("library.id"))

Based on the model schemas, what relationship do the classes Library and Book 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

  • C

    One-to-One

Question 25

+4.5 marksOne correct option

Consider the <span> element and the styling given to it in <style> tag using element selector in the HTML file below.

html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Span</title>
<style>
span{
color: red;
border:1px solid blue;
}
</style>
</head>
<body>
<span id="this_span">Hello Students! MAD-I welcomes you!
</span>
</body>
</html>

What will be the final style applied to <span> tag if an additional style is added via the ID selector given below?

css
#this_span{
width: 1200px;
border: 2px solid pink;
}
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 26

+4.5 marksOne correct option
  1. A

    Software package A

  2. B

    Software package B

  3. C

    Both Software packages A and B will take same time to process 10⁶ items

  4. D

    Both Software packages A and B will take infinitely long time to process 10⁶ items

Show answer

Correct answer

  • A

    Software package A

Question 27

+4.5 marksOne correct option

Consider the following Python code snippet.

python
from jinja2 import Template
data = [
{"vehicle_id":"ev101", "vehicle_name":"electroN", "fuel_type":"electric"},
{"vehicle_id":"pt201", "vehicle_name":"discover", "fuel_type":"petrol"},
{"vehicle_id":"dz301", "vehicle_name":"apex", "fuel_type":"diesel"},
]
this_text = """
<h1> Ordered Vehicles </h1>
{% set keys = data[0].keys() %}
{% set keys = keys|list %}
{% for i in range(data|length) %}
{{keys[i]}} : {{data[i][keys[i]]}}
{% endfor %}
<h3> Total: {{ data|length }} </h3>
"""
this_temp = Template(this_text)
rendered = this_temp.render(data = data[::-1])
print(rendered)

How will the browser render the output of the above given Python code?

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

Correct answer

  • D

Question 28

+4.5 marksOne correct option

Based on the above data, answer the given subquestions.

At what distance (kms) should the router be placed from the client so that round-trip latency of the network remains as low as 110 milliseconds?

  1. A

    6000 kilometers

  2. B

    4500 kilometers

  3. C

    7500 kilometers

  4. D

    8000 kilometers

Show answer

Correct answer

  • B

    4500 kilometers

Question 29

+3 marksOne correct option

Based on the above data, answer the given subquestions.

What will be the round-trip latency (milliseconds) of the network if the router is placed at exactly midway from the client and the server?

  1. A

    6

  2. B

    60

  3. C

    110

  4. D

    120

Show answer

Correct answer

  • D

    120

Question 30

+2 marksOne or more correct options

Consider the Amazon Alexa device. Which of the following would constitute the view of the application behind such a device?

Select all that apply.

  1. A

    The AI voice

  2. B

    The LED light around the device

  3. C

    The body of the device

  4. D

    None of these

Show answer

Correct answers

  • A

    The AI voice

  • B

    The LED light around the device

Question 31

+4.5 marksOne correct option

Consider the following resource API created with help of flask_restful.

python
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class TestApi(Resource):
def post(self, state, city):
return {"state": state, "capital": city}
def get(self):
info = request.args
return info
api.add_resource(TestApi, '/india','/india/<state>/<city>')
app.run(debug = True)

If the above application is running locally on http://127.0.0.1:5000, answer the given subquestions

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

Correct answer

  • B

Question 32

+4.5 marksOne correct option

Consider the following resource API created with help of flask_restful.

python
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class TestApi(Resource):
def post(self, state, city):
return {"state": state, "capital": city}
def get(self):
info = request.args
return info
api.add_resource(TestApi, '/india','/india/<state>/<city>')
app.run(debug = True)

If the above application is running locally on http://127.0.0.1:5000, answer the given subquestions

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

Correct answer

  • B