MAD Study Hub

Home / Past papers / MAD1 Quiz 2 / this paper

Modern Application Development I 06 Apr 26 - 12 Apr 2026

MAD1 Quiz 216 questions50 marks12 MCQ · 4 MSQ
Elapsed 00:00
Q1MCQ2 marks
You want to create an app where students can log in and download hall tickets. To make this more efficient, you want to have some very quick way to check whether a given user has already downloaded their hall ticket or not. Which kind of database will you prefer?
  1. RDBMS
  2. Doc-oriented database
  3. Graph database
  4. Key-value store
Q2MCQ2 marks
Which of the following enables asynchronous communication between client and server without loading the entire web page?
  1. CGI
  2. FTP
  3. SMTP
  4. AJAX
Q3MCQ3 marks
Consider the following Flask application. question figure question figure
Text of the picture (copyable)
```python
from flask import Flask, request
from string import Template

app = Flask(__name__)

@app.route("/welcome")
def welcome():
    username = request.args.get("user", "Guest")
    role = request.args.get("role", "Member")

    t = Template("Hello $name! Your role is $role_type.")
    result = t.substitute(name=username.upper(), role_type=role.lower())
    return result

if __name__ == "__main__":
    app.run()
```
Assume that the Flask app is running at http://127.0.0.1:5000. What will be the rendered output in the browser for the URL: http://127.0.0.1:5000/welcome?user=Alice&role=ADMIN
  1. text
    It raises a KeyError because `$role_type` is missing in the URL.
  2. Hello Guest! Your role is member.
  3. Hello Alice! Your role is ADMIN.
  4. Hello ALICE! Your role is admin.
Q4MCQ3 marks
Consider the following Python code. question figure Which of the following is the correct output of the above code?
Text of the picture (copyable)
```python
def modify(func):
    def wrapper(p, q):
        result = func(p, q)
        return result + 5
    return wrapper

@modify
def bar(a, b):
    return a * b

print(bar(2, 3))
```
  1. 56
  2. 11
  3. 6
  4. 30
Q5MCQ3 marks
A server has a 16-core CPU, 64 GB RAM and 1 Gbps network connection. The server is running a single instance of an app that can generate a maximum of 500 HTML pages per second, each of which results in a 100KB image to be downloaded by the client. What is the maximum number of requests per second that can be handled by this setup?
  1. 10,000
  2. 1250
  3. 1000
  4. 500
Q6MCQ3 marks
A web server is connected to a 5Mbps network line. Each HTTP request contains 4KB of header information and 6KB of payload. What is the maximum number of requests per second the web server can support?(Note: 1KB=1000B, 1MB=1000KB and so on)
  1. 500
  2. 62
  3. 124
  4. 31
Q7MCQ3 marks
Consider the following HTML/CSS code. question figure What will be the output when the above HTML file is rendered?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<head>
<style>
    p { color: blue; }
    .text { color: green; }
    #para { color: red; }
</style>
</head>
<body>
<p id="para" class="text" style="color: black;">
    IITM BS Degree Program
</p>
</body>
</html>
```
  1. text
    IITM BS Degree Program
  2. text
    IITM BS Degree Program
  3. text
    IITM BS Degree Program
  4. text
    IITM BS Degree Program
Q8MCQ3 marks
You have a DRAM module with bus width of 64 bits, clock speed of 1 GHz, and operating in DDR (double-data-rate or two values per clock cycle) mode. What is the maximum bandwidth (in Giga-bytes per second) of data transfer achievable with this module?
  1. 8 GigaBytes/s
  2. 16 GigaBytes/s
  3. 24 GigaBytes/s
  4. None of these
Q9MSQ2 marksselect all that apply
Which of the following flask routes can take dynamic value in the URL like “/user/55”?
  1. text
    ```python
    @app.route("/user/id")
    ```
  2. text
    ```python
    @app.route("/user/<int:id>")
    ```
  3. text
    ```python
    @app.route("/user/<id>")
    ```
  4. text
    ```python
    @app.route("/user/<float:id>")
    ```
Q10MSQ2 marksselect all that apply
Consider the following Python Flask code. question figure question figure
Text of the picture (copyable)
```python
from flask import Flask
app=Flask(__name__)
@app.route("/user/<name>")
def greet(name):
    return f"<p>Welcome {name}</p>"
app.run(debug=True)
```
Assume that the Flask app is running at http://127.0.0.1:5000. Which of the following URL requests will render the output without any errors?
  1. http://127.0.0.1:5000/user/IITM
  2. http://127.0.0.1:5000/user/101
  3. http://127.0.0.1:5000/user/10/greet
  4. http://127.0.0.1:5000/user
  5. http://127.0.0.1:5000/user/BS?id=101
Q11MCQ4 marks
Consider the following HTML and Python Flask code. question figure question figure question figure
Text of the picture (copyable)
Filename: app.py

```python
from flask import Flask, render_template
app=Flask(__name__)
@app.route("/")
def home():
    return render_template("index.html")
app.run(debug=True)
```
Filename: index.html

```html
<!DOCTYPE html>
<html lang="en">
<body>
    <div>
        Output is:
        {% for i in [1,2,3] %}
            {% set x = i %}
        {% endfor %}
        {{ x }}
    </div>
</body>
</html>
```
Assume that the Flask app is running at http://127.0.0.1:5000. What will be the rendered output
in the browser for the URL: http://127.0.0.1:5000?
  1. Output is: 3
  2. Output is:
  3. Output is: 1 2 3
  4. Output is: 1 2 3 3
Q12MCQ4 marks
Consider the following HTML code. question figure What will be the output in the console window when the above HTML doc is rendered on the browser ?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<body>
    <ol id="lst">
        <li>App Dev-1</li>
    </ol>
</body>
<script>
    let lst_items=document.getElementsByTagName("li");
    document.getElementById("lst").innerHTML += "<li>App Dev-2</li><li>App dev projects</li>";
    console.log(lst_items.length);
</script>
</html>
```
  1. 1
  2. 2
  3. 3
  4. 4
Q13MSQ5 marksselect all that apply
Consider the following Python Flask code. question figure
Text of the picture (copyable)
Filename: app.py

```python
from flask import Flask, request
app=Flask(__name__)
@app.route("/login",methods=["POST"])
def signin():
    args=request.get_json()
    if args["uid"]=="admin" and args["pwd"]=="12345":
        return "Welcome Admin!"
    else:
        return "Invalid credentials..."

app.run(debug=True)
```

Assume that the Flask app is running at http://127.0.0.1:5000. Which of the following "curl" commands or URL requests returns Method Not Allowed error(on bash terminal)?
  1. curl -X POST --json '{"uid":"admin","pwd":"xyz"}' http://127.0.0.1:5000/login
  2. curl -X GET --json '{"uid":"admin","pwd":"xyz"}' http://127.0.0.1:5000/login
  3. URL request: http://127.0.0.1:5000/login
  4. curl --json '{"uid":"admin","pwd":"12345"}' http://127.0.0.1:5000/login
  5. curl -X POST --json '{"uid":"admin","pwd":"12345"}' http://127.0.0.1:5000/login
Q14MSQ5 marksselect all that apply
Consider the following Python Flask RESTful API code. question figure question figure
Text of the picture (copyable)
```python
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

products = [
    {"id": 1, "name": "books", "price": 56},
    {"id": 2, "name": "pens", "price": 61},
    {"id": 3, "name": "bulbs", "price": 76},
]

class MyApiResource(Resource):
    ### Missing code ###

api.add_resource(MyApiResource, "/<int:id>")

if __name__ == "__main__":
    app.run(debug=True)
```
Assume that the Flask app is running at http://127.0.0.1:5000. Which of the following codes when placed at ###Missing code ### will work correctly to search a product by id?
  1. question figure
    text
    ```python
    def post(self):
        for p in products:
            if p["id"] == id:
                return f"{p['id']}, {p['name']}, {p['price']}"
        return f"msg: {id} not found"
    ```
  2. question figure
    text
    ```python
    def get(self,id):
        for p in products:
            if p["id"] == id:
                return f"{p['id']}}, {p['name']}}, {p['price']}}"
        return f"msg: {id} not found"
    ```
  3. question figure
    text
    ```python
    def get(self):
        for p in products:
            if p["id"] == id:
                return f"{p['id']}, {p['name']}, {p['price']}"
        return f"msg: {id} not found"
    ```
  4. question figure
    text
    ```python
    def post(self, id):
        for p in products:
            if p["id"] == id:
                return f"{p['id']}, {p['name']}, {p['price']}"
        return f"msg: {id} not found"
    ```
Comprehension passage - the questions below it refer to this
Consider the following SQLAlchemy class models. question figure Based on the above data, answer the given subquestions.
Q15MCQ3 marks
Which of the following relationships exists between the “User” and “Profile” models?
  1. Many-to-Many
  2. Many-to-One
  3. One-to-Many
  4. One-to-One
Q16MCQ3 marks
What will be the output if the following commands are executed in the python shell. question figure
Text of the picture (copyable)
```python
>>> u1 = User(uname = "Jane", pwd = "1234")
>>> p1 = Profile(name = "Analyst", email = "zoozle.com", user_id = u1.id)
>>> db.session.add_all([u1,p1])
>>> db.session.commit()
>>> user1 = User.query.filter_by(uname="Jane").first()
>>> user1.profile
```
  1. text
    <User 1>
  2. text
    ```
    [<Profile 1>]
    ```
  3. text
    ```html
    <Profile 1>
    ```
  4. text
    ```
    'Analyst'
    ```

Answer key

  1. Q1 (MCQ, 2 marks): D
  2. Q2 (MCQ, 2 marks): D
  3. Q3 (MCQ, 3 marks): D
  4. Q4 (MCQ, 3 marks): B
  5. Q5 (MCQ, 3 marks): D
  6. Q6 (MCQ, 3 marks): B
  7. Q7 (MCQ, 3 marks): C
  8. Q8 (MCQ, 3 marks): B
  9. Q9 (MSQ, 2 marks): B, C
  10. Q10 (MSQ, 2 marks): A, B, E
  11. Q11 (MCQ, 4 marks): B
  12. Q12 (MCQ, 4 marks): C
  13. Q13 (MSQ, 5 marks): B, C
  14. Q14 (MSQ, 5 marks): B, D
  15. Q15 (MCQ, 3 marks): D
  16. Q16 (MCQ, 3 marks): C