MAD Study Hub

Home / MAD1 / Week 1 / Real questions

MAD1 week 1 - real exam questions

60 questions pulled from past papers whose wording matches this week's topics, newest first, duplicates removed. Pick your answers, then press Check answers. Figures and answer keys are the originals.

Elapsed 00:00
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 1MCQ3 marks
Which of the following statements is correct? Statement 1: In Server-Side Rendering (SSR), the client's browser receives a nearly empty HTML skeleton and relies heavily on client-side JavaScript execution to fetch data and construct the Document Object Model (DOM). Statement 2: Client-Side Rendering (CSR) reduces the immediate processing load on the web server by offloading UI layout rendering tasks to the user's browser engine.
  1. Both are incorrect
  2. Both are correct
  3. Only Statement 1 is correct
  4. Only Statement 2 is correct
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 2MSQ5 marksselect all that apply
Consider the following flask app. question figure If the application is running locally on http://127.0.0.1:5000, select the correct options.
Text of the picture (copyable)
```python
from flask import Flask, abort, redirect, url_for
app = Flask(__name__)

@app.route('/course/<path:subject>')
def course(subject):
    if "Python" in subject:
        return "Welcome to Python course!"
    else:
        abort(404)

@app.route('/learn/<path:subject>')
def learn(subject):
    if "Python" in subject:
        return redirect(url_for('course', subject=subject))
    else:
        abort(404)

@app.errorhandler(404)
def not_found(error):
    return "<h2>Course not available!</h2>"

app.run(debug=True)
```
  1. question figure
    text
    For the URL:
    
    ```
    http://127.0.0.1:5000/learn/web/Python?level=advanced
    ```
    
    The browser will render:
    
    **Course not available!**
  2. question figure
    text
    For the URL:
    
    ```
    http://127.0.0.1:5000/course/ML/Python?topic=NLP
    ```
    
    The browser will render:
    
    Welcome to Python course!
  3. question figure
    text
    For the URL:
    
    ```
    http://127.0.0.1:5000/learn/basics/Python?level=beginner
    ```
    
    The browser will render:
    
    Welcome to Python course!
  4. question figure
    text
    For the URL:
    
    ```
    http://127.0.0.1:5000/course/Java/React?type=Framework
    ```
    
    The browser will render:
    
    **Course not available!**
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 3MCQ2 marks
What does the following curl command do?
Text of the picture (copyable)
```
curl -X PUT -d "status=active&role=admin" https://api/users/update
```
  1. Sends a PUT request to update data using form format.
  2. Sends a PUT request using JSON encoding.
  3. Sends a GET request to retrieve user information.
  4. Sends a DELETE request to remove user data.
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 4MCQ2 marks
In the context of asynchronous updates, which of the following statements is correct?
  1. It updates a web page without reloading the whole page
  2. It leads to better user experience as it involves quick response on the main page with minimal data to refresh
  3. Both It updates a web page without reloading the whole page and It leads to better user experience as it involves quick response on the main page with minimal data to refresh are correct
  4. None of these
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 5MCQ4 marks
Consider the following Flask RESTful API code. question figure What will be the response?
Text of the picture (copyable)
File name: app.py
```python
from flask_restful import reqparse, Resource, Api
from flask import Flask

parser = reqparse.RequestParser()
parser.add_argument("n", type=int, required=True)
app = Flask(__name__)
api = Api(app)

class MyResponse(Resource):
    def post(self):
        args = parser.parse_args()
        return args

api.add_resource(MyResponse, "/")
app.run(debug=True)
```

Assume that the Flask app is running at http://127.0.0.1:5000. The client sends the below CURL request in the git bash terminal.

```bash
curl -X POST http://127.0.0.1:5000 -H "Content-Type: application/json" -d "{\"n\":3}"
```
  1. {"n": 3}
  2. Runtime error
  3. 400 Bad Request
  4. { }
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 6MSQ4 marksselect all that apply
Consider the following Flask app code. question figure The above flask app is running on "http://127.0.0.1:5000". Which of the following commands will return a runtime error?
Text of the picture (copyable)
```python
from flask import Flask
from flask_restful import Resource, Api

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

class UserResource(Resource):
    def get(self):
        return {"status": "GET request"}, 200

    def post(self, user_id):
        return {"status": "POST request", "user_id": user_id}, 201

api.add_resource(UserResource, "/users", "/users/<int:user_id>")

if __name__ == "__main__":
    app.run(debug=True)
```
  1. text
    ```
    curl http://127.0.0.1:5000/users/5001 -X GET
    ```
  2. text
    ```
    curl http://127.0.0.1:5000/users/5001 -X POST
    ```
  3. text
    ```
    curl http://127.0.0.1:5000/users -X POST
    ```
  4. text
    ```
    curl http://127.0.0.1:5000/users -X GET
    ```
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 7SA3 marks
An e-commerce web application stores user shopping cart information as server-side session state. Each active user session occupies an average of 4 KB of memory. During a flash sale, the application is expected to handle 1.5 million concurrent active sessions, all stored in a centralized Redis cache server. What is the minimum RAM capacity (in GB) required solely to store these session states? (Assume that 1000B=1KB, 1000KB=1MB and so on)
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 8MCQ2 marks
Consider the following HTML/CSS code. question figure What will be rendered by the browser?
Text of the picture (copyable)
File name: home.html

```html
<!DOCTYPE html>
<html lang="en">
<style>
    div{color:green}
    .cdiv{color:red}
    #div1{color:blue}
</style>
<body>
    <div id="div1" class="cdiv">IITM BS Degree in Data Science</div>
</body>
</html>
```
  1. question figure
    text
    IITM BS Degree in Data Science
  2. question figure
    text
    IITM BS Degree in Data Science
  3. question figure
    text
    IITM BS Degree in Data Science
  4. question figure
    text
    1. IITM BS Degree in Data Science
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 9MCQ2 marks
Comprehension passage for this question
Consider the following HTML and Python flask code. question figure Assume that the Flask app is running at http://127.0.0.1:5000. Based on the above data, answer the given subquestions.
Which of the following statements are correct? Statement 1: Accessing the URL: http://127.0.0.1:5000 directly in the browser makes a GET request. Statement 2: Clicking on the Submit button will invoke the POST request method.
  1. Both statements are correct
  2. Both statements are incorrect.
  3. Statement 1 is incorrect, but statement 2 is correct.
  4. Statement 2 is incorrect, but statement 1 is correct.
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 10MCQ3 marks
A web server has an outgoing bandwidth of 6 Gbps, and each client requires 2 Mbps. What is the maximum number of concurrent requests allowed? (Use: 1KB= 1000Bytes, 1MB=1000KB and so on.)
  1. 3
  2. 30
  3. 3000
  4. 300
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 11MCQ3 marks
Consider the following Flask code. File name: app.py question figure What will be the output when you run the following code in the terminal and then access in the browser with the following link ?
Text of the picture (copyable)
```python
from flask import Flask
import sys

app = Flask(__name__)

MULTIPLIER = int(sys.argv[1]) if len(sys.argv) > 1 else 2

@app.route('/calculate/<int:value>')
def calculate(value):
    return f"Result: {value * MULTIPLIER}"

if __name__ == '__main__':
    app.run()
```
```
python app.py 7
```
http://localhost:5000/calculate/6
  1. Result: 42
  2. Result: 13
  3. Result: 7
  4. Result: 12
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 12MCQ3 marks
Consider the following Python flask code. question figure
Text of the picture (copyable)
```python
from flask import Flask, request
app = Flask(__name__)

@app.route("/total")
def total():
    price = request.args.get("price", 0)
    qty = request.args.get("qty", 1)
    result = price * qty
    return str(result)

app.run()
```

Assume that the above Flask app is running at http://127.0.0.1:5000. What will be rendered for the URL request http://127.0.0.1:5000/total?price=5&qty=2?
  1. 55
  2. 52
  3. 10
  4. TypeError
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 13MCQ3 marks
Consider the following Python flask code. question figure
Text of the picture (copyable)
```python
from flask import Flask

app = Flask(__name__)

@app.route("/user/<name>")
def user(name):
    return f"User: {name}"

@app.route("/user/admin")
def admin():
    return "Admin Panel"

app.run()
```

Assume that the Flask app is running at http://127.0.0.1:5000. What response is returned when http://127.0.0.1:5000/user/admin is accessed?
  1. Admin Panel
  2. User: admin
  3. 404 Error
  4. Internal Server Error
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 14MSQ3 marksselect all that apply
Consider the following Python Flask code. question figure
Text of the picture (copyable)
File name: app.py
```python
from flask import Flask

app = Flask(__name__)

@app.route("/calculate/<int:v1>/<int:v2>")
def compute(v1, v2):
    try:
        return f"{v1 / v2}"
    except:
        return "Arithmetic operation error!"

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 return **Not Found** ?
  1. text
    ```
    http://127.0.0.1:5000/calculate/10/5
    ```
  2. text
    ```
    http://127.0.0.1:5000/calculate/3/0.2
    ```
  3. text
    ```
    http://127.0.0.1:5000/calculate/3/2?v1=1
    ```
  4. text
    ```
    http://127.0.0.1:5000/calculate?v1=5&v2=2
    ```
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 15SA3 marks
Suppose a client machine C is communicating with a data center D located 12,500 km away from C. Assume that the TCP connection has been established and is kept alive. Calculate the RTT (Round trip time) in ms for an HTTP request. (Assume speed of light in cable is 2e8 m/s).
MAD1 End Term · 10 May 2026 · open the full paper
Practice 16MCQ2 marks
Which of the following is the correct match between Column A and Column B? question figure
Text of the picture (copyable)
| Column A | Column B |
|---|---|
| 1. ftp | A. Web domain |
| 2. 127.0.0.1 | B. Protocol |
| 3. `<b></b>` | C. Decorator |
| 4. seek.onlinedegree.iitm.ac.in | D. Loop back IP |
| 5. @app.route | E. HTML element |
  1. 1-B, 2-D, 3-E, 4-A, 5-C
  2. 1-B, 2-A, 3-E, 4-D, 5-C
  3. 1-A, 2-D, 3-E, 4-B, 5-C
  4. 1-B, 2-D, 3-C, 4-A, 5-E
MAD1 End Term · 10 May 2026 · open the full paper
Practice 17MCQ2 marks
Logging is typically used for what purpose?
  1. detect unusual activity on the server.
  2. block unauthorized access.
  3. enforce HTTPS connections.
  4. convert HTTP to HTTPS.
MAD1 End Term · 10 May 2026 · open the full paper
Practice 18MCQ2 marks
A web server has an outgoing bandwidth of 5Gbps, and each client requires 2Mbps. What is the maximum number of concurrent requests allowed? (Use: 1KB= 1000Bytes, 1MB=1000KB and so on)
  1. 2.5
  2. 25
  3. 250
  4. 2500
MAD1 End Term · 10 May 2026 · open the full paper
Practice 19MSQ3 marksselect all that apply
Consider the following Python Flask code. question figure Which of the following options are true?
Text of the picture (copyable)
File name: app.py
```python
from flask import Flask, url_for

app = Flask(__name__)

@app.route("/home")
def index():
    return "Home page!"

@app.route("/login")
def signin():
    return "Login page!"

@app.route("/<route>")
def get_url(route):
    return url_for(route, _external=True)

app.run(debug=True)
```
Assume that the Flask app is running at http://127.0.0.1:5000.
  1. URL request: http://127.0.0.1:5000/signin will return output: http://127.0.0.1:5000/login
  2. URL request: http://127.0.0.1:5000/login will return output: http://127.0.0.1:5000/login
  3. URL request: http://127.0.0.1:5000/index will return output: http://127.0.0.1:5000/home
  4. URL request: http://127.0.0.1:5000/home will return output: http://127.0.0.1:5000/home
MAD1 End Term · 10 May 2026 · open the full paper
Practice 20MSQ3 marksselect all that apply
Consider the following Python Flask code. question figure
Text of the picture (copyable)
File name: app.py

```python
from flask import Flask

app = Flask(__name__)

@app.route("/calculate/<v1>/<v2>")
def compute(v1, v2):
    try:
        return f"{int(v1) / int(v2)}"
    except:
        return "Arithmetic operation error!"

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 return "Arithmetic operation error!"?
  1. text
    ```
    http://127.0.0.1:5000/calculate/4/"2"
    ```
  2. text
    http://127.0.0.1:5000/calculate/4/4
  3. text
    ```
    http://127.0.0.1:5000/calculate/4/0.2
    ```
  4. text
    ```
    http://127.0.0.1:5000/calculate/4/2?v1=1
    ```
  5. text
    ```
    http://127.0.0.1:5000/calculate/4.0/0.5
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 21MCQ3 marks
Consider the following HTML code snippet (without any CSS styling). question figure Which of the following statements correctly describes how the elements will be displayed by default in a browser?
Text of the picture (copyable)
```html
<div>
  <h1>Content 1</h1>
  <p>Content 2</p>
  <span>Content 3</span>
  <span>Content 4</span>
</div>
```
  1. The content of all elements will appear on the same line as they are inline elements.
  2. The content of , and tags will start on new lines as they are block elements.
    text
    `<h1/>`
    `<p>`
    ```html
    <span>
    ```
  3. The content of and tags will start on new lines, others will display inline.
    text
    `<h1/>`
    `<p>`
  4. The content of tags will start on new lines, others will display inline.
    text
    ```html
    <span>
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 22MCQ3 marks
What does the following curl command do? question figure
Text of the picture (copyable)
```
curl -X POST -d "email=user@test.com&password=secret" https://auth/signin
```
  1. Sends a POST request to retrieve authentication data.
  2. Sends a POST request to send form data.
  3. Sends a POST request to send JSON data.
  4. Sends a POST request to retrieve user credentials.
MAD1 End Term · 10 May 2026 · open the full paper
Practice 23MCQ3 marks
Comprehension passage for this question
Consider the following HTML and Python flask code. question figure Based on the above data, answer the given subquestions. question figure
Which of the following statements are correct for the statements below? Statement 1: Accessing the URL: http://127.0.0.1:5000 directly in the browser makes a POST request. Statement 2: Clicking on the Submit button will invoke the GET request method.
  1. Both statements are correct.
  2. Both statements are incorrect.
  3. Statement 1 is incorrect, but statement 2 is correct.
  4. Statement 2 is incorrect, but statement 1 is correct.
MAD1 End Term · 10 May 2026 · open the full paper
Practice 24MCQ4 marks
Consider the following Flask RESTful API code. question figure Assume that the Flask app is running at http://127.0.0.1:5000. The client sends the below CURL request in the git bash terminal. question figure What will be the response?
Text of the picture (copyable)
File name: app.py
```python
from flask_restful import reqparse, Resource, Api
from flask import Flask

parser = reqparse.RequestParser()
parser.add_argument("n", type=int, required=True)
app = Flask(__name__)
api = Api(app)

class MyResponse(Resource):
    def post(self):
        args = parser.parse_args()
        return args

api.add_resource(MyResponse, "/")
app.run(debug=True)
```
```
curl -X POST http://127.0.0.1:5000 -H "Content-Type: application/json" -d '{}'
```
  1. {"n": None}
  2. Runtime error
  3. 400 Bad Request
  4. { }
MAD1 End Term · 10 May 2026 · open the full paper
Practice 25MCQ4 marks
Consider the following HTML templates and Python Flask code. question figure Assume that the Flask app is running at . What will be rendered for the URL request ?
Text of the picture (copyable)
File name: base.html
```html
<!DOCTYPE html>
<html lang="en">
<body>
    {% block content %}
    <div>Parent content</div>
    {% endblock %}
</body>
</html>
```

File name: child.html
```html
{% extends "base.html" %}
{% block content %}
    <div>Child content</div>
{% endblock %}
```

File name: app.py
```python
from flask import Flask, render_template

app = Flask(__name__)

@app.route("/home")
def index():
    return render_template("child.html")

app.run(debug=True)
```
http://127.0.0.1:5000
http://127.0.0.1:5000/home
  1. Parent content Child content
  2. Parent content
  3. Child content
  4. Child content Parent content
MAD1 End Term · 10 May 2026 · open the full paper
Practice 26MCQ5 marks
Consider the following Flask SQLAlchemy models and RESTful API code. question figure
Text of the picture (copyable)
File name: app.py
```python
class User(db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    full_name = db.Column(db.String, unique=True)

class UserPosts(db.Model):
    __tablename__ = "user_posts"
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String, unique=True, nullable=False)
    description = db.Column(db.String, nullable=True)
    user_id = db.Column(db.Integer, db.ForeignKey("user.id"))

class UserApi(Resource):
    def post(self):
        user_data = request.json
        ==Missing code 1==
        db.session.add(user)
        db.session.commit()
        return {"msg": "User added!"}, 201

class UserPostsApi(Resource):
    def post(self):
        post_data = request.json
        ==Missing code 2==
        db.session.add(user_post)
        db.session.commit()
        return {"msg": "Post added!"}, 201
```
Which of the following is the most suitable ==Missing code 1== and ==Missing code 2==? So that the Flask application does not return any run-time error?
  1. question figure
    text
    ==Missing code 1==
    ```python
    user = User(full_name=user_data["full_name"])
    ```
    
    ==Missing code 2==
    ```python
    user_post = UserPosts(
        title=post_data["title"],
        description=post_data["description"],
        user_id=post_data["user_id"],
    )
    ```
  2. question figure
    text
    ```python
    ==Missing code 1==
    user = User(name=user_data["full_name"])
    
    ==Missing code 2==
    user_post = UserPosts(
        post_title=post_data["title"],
        post_description=post_data["description"],
        post_user_id=post_data["user_id"],
    )
    ```
  3. question figure
    text
    ```python
    ==Missing code 1==
    user_data = User(full_name=user_data["full_name"])
    
    ==Missing code 2==
    user_post_data = UserPosts(
        title=post_data["title"],
        description=post_data["description"],
        user_id=post_data["user_id"],
    )
    ```
  4. question figure
    text
    ```
    ==Missing code 1==
    user_data = User(name=user_data["full_name"])
    
    ==Missing code 2==
    user_post_data = UserPosts(
        post_title=post_data["title"],
        post_description=post_data["description"],
        post_user_id=post_data["user_id"],
    )
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 27MCQ5 marks
Consider the following flask application "app.py" given below. question figure
Text of the picture (copyable)
```python
import sys
from flask import Flask, render_template

app = Flask(__name__, static_folder = 'public')

@app.route('/')
def func():
    folder_1 = sys.argv[1]
    folder_2 = sys.argv[2]

    if app.static_folder == folder_1:
        return f"<h1>Static folder verified: {folder_1}</h1>"

    if app.static_folder == folder_2:
        return f"<h1>Static folder verified: {folder_2}</h1>"

    return "<h1>Invalid argument</h1>"

app.run(debug = True)
```

If the application is running locally on http://127.0.0.1:5000. What will be rendered by the browser for the command:

```
python app.py /assets /public
```
  1. Static folder verified: /assets
  2. Static folder verified: /public
  3. Invalid argument
  4. None of these
MAD1 End Term · 10 May 2026 · open the full paper
Practice 28MSQ4 marksselect all that apply
Consider the following flask app. Given that allows code to be tested without a server, which of the following statements is correct? question figure
Text of the picture (copyable)
```
test_request_context()
```
```python
from flask import Flask, url_for

app = Flask(__name__)

@app.route('/api')
def api():
    return 'API Response'

@app.route('/data/<category>')
def data(category):
    return f'Data for {category}'

with app.test_request_context():
    #== print statement ==#
```
  1. If is replaced by , the output on the terminal will be
    text
    ```python
    #=== print statement ===#
    ```
    ```python
    print(url_for('data', category='sales'))
    ```
    ```
    /data?category=sales
    ```
  2. If is replaced by , the output on the terminal will be
    text
    ```python
    #=== print statement ===#
    ```
    ```python
    print(url_for('data', category='sales', format='json'))
    ```
    ```
    /data/sales/json
    ```
  3. If is replaced by , the output on the terminal will be
    text
    ```python
    #=== print statement ===#
    ```
    ```python
    print(url_for('api', category='sales'))
    ```
    ```
    /api?category=sales
    ```
  4. If is replaced by , the output on the terminal will be
    text
    ```python
    #=== print statement ===#
    ```
    ```python
    print(url_for('api'))
    ```
    /api
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 29MCQ2 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 30MCQ3 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.
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 31MCQ3 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 32MCQ3 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 33MSQ2 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>")
    ```
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 34MSQ2 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 35MCQ4 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 36MCQ4 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 37MSQ5 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 38MSQ5 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"
    ```
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 39MCQ4 marks
A client sitting in a train is connected to a server through a network tower that has a range of 4.5 kilometers and a constant bandwidth of 5 Mbps. The train is at a negligible distance from the tower and is moving away from it at a speed of 180 kmph. How much data (in Megabytes) will be used by the client before the train completely moves out of the coverage area, assuming that the client is consuming the entire bandwidth?
  1. 45 MB
  2. 450 MB
  3. 5.6 MB
  4. 56.25 MB
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 40MCQ5 marks
Consider the following flask app. question figure Select the option which correctly matches the URL in column A with the rendered output in column B, if the application is running locally on http://127.0.0.1:5000. question figure
Text of the picture (copyable)
```python
from flask import Flask, request
app = Flask(__name__)

@app.route('/calculate')
def calculate():
    a = request.args.get('a')
    b = request.args.get('b', 2)
    c = request.args.get('c', "5")

    try:
        a = int(a)
        b = int(b)
        c = int(c)
    except:
        return "Invalid Input"

    if a + b == c:
        return f"Sum: {a+b}"
    elif a * c == b:
        return f"Product: {a*b}"
    else:
        return f"No match: {a+b+c}"

app.run(debug=True)
```
| URL | Output |
|---|---|
| 1. http://127.0.0.1:5000/calculate?a=3 | a. Sum: 6 |
| 2. http://127.0.0.1:5000/calculate?a=3&d=5 | b. Invalid Input |
| 3. http://127.0.0.1:5000/calculate?a=1&b=5 | c. Sum: 5 |
| 4. http://127.0.0.1:5000/calculate?a=1&b=5&c=6 | d. Product: 5 |
  1. 1-b, 2-b, 3-a, 4-a
  2. 1-b, 2-b, 3-d, 4-a
  3. 1-c, 2-c, 3-d, 4-a
  4. 1-c, 2-b, 3-d, 4-a
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 41MCQ3 marks
Consider the following code: app.py question figure You are running a Flask web application locally using the command: python app.py. On which URL will the application be accessible in the browser?
Text of the picture (copyable)
```python
from flask import Flask
app = Flask(__name__)

@app.route("/")
def port():
    return "This is the same port question. Yet again, for a reason."

if __name__ == "__main__":
    app.run(port=0007)
```
  1. https://127.0.0.1:5000/
  2. http://localhost:0007/
  3. http://0.0.0.0:0007/
  4. None of these
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 42MCQ3 marks
Consider the following HTML and Python flask codes. question figure question figure question figure
Text of the picture (copyable)
File name: home.html

```html
<body>
  {% if user == "admin" %}
  <p>Welcome Admin</p>
  {% else %}
  <p>Welcome User</p>
  {% endif %}
</body>
```
File name: app.py

```python
from flask import Flask,render_template

app = Flask(__name__)

@app.route("/")
def login():
    return render_template("home.html",user="admin iitm")

app.run(debug=True)
```
Assume that the above code is running on http://127.0.0.1:5000. What will be the rendered output for the URL request http://127.0.0.1:5000 ?
  1. Welcome Admin
  2. Welcome User
  3. 404 Not Found
  4. Nothing will be rendered
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 43MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Flask application running on http://127.0.0.1:5000.
```python
from flask import Flask
app = Flask(__name__)

@app.route('/profile/<string:username>')
def profile(username):
    return f"Profile of {username}"

@app.route('/post/<int:post_id>')
def post(post_id):
    return f"Post ID: {post_id}"

app.run(debug=True)
```
What will happen when accessing http://127.0.0.1:5000/post/abc123 ?
  1. It will render "Post ID: abc123"
  2. Flask will return a 404 error because abc123 cannot be converted to integer
  3. It will render "Profile of abc123"
  4. The application will crash with a TypeError
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 44MCQ2 marks
Which command would you use to get detailed information about the HTTP request and response, including headers, and to help debug the HTTP request when using curl?
  1. text
    ```
    curl -i <URL>
    ```
  2. text
    ```
    curl -v <URL>
    ```
  3. text
    ```
    curl --headers <URL>
    ```
  4. text
    ```
    curl -X GET <URL>
    ```
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 45MSQ2 marksselect all that apply
Which of the following is/are True about Web Applications?
  1. All web applications run entirely in the client's browser without requiring a server.
  2. Web applications can interact with backend services using APIs.
  3. A web application typically consists of frontend, backend and database components.
  4. Web applications cannot be accessed unless they are installed on the user’s computer.
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 46MCQ4 marks
Consider the following flask app and Jinja2 template. question figure If the flask app is running locally on http://127.0.0.1:5000. What will be the output on the browser for the base URL?
Text of the picture (copyable)
app.py
```python
from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def home():
    return render_template("index.html", items=['DaShBoard', 'SETtings',
                                                 'HELP'])

app.run()
```

index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Menu</title>
</head>
<body>
    {% macro nav_list(elements) %}
    <ol>
        {% for element in elements %}
        <li><a href="/{{ element|lower }}">{{ element|upper }}</a></li>
        {% endfor %}
    </ol>
    {% endmacro %}

    {{ nav_list(items) }}
</body>
</html>
```
  1. question figure
    text
    1. DaSHBoard
    2. SETtings
    3. HELP
  2. question figure
    text
    1. dashboard
    2. settings
    3. help
  3. question figure
    text
    1. DASHBOARD
    2. SETTINGS
    3. HELP
  4. question figure
    text
    1. DASHBOARD
    2. SETTINGS
    3. HELP
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 47MCQ4 marks
Comprehension passage for this question
Consider the following flask application and html template. Assume that the Flask app is running at http://127.0.0.1:5000. question figure Based on the above data, answer the given subquestions. question figure
What will be the final styling applied to the element inside the div for the URL: http://127.0.0.1:5000/?color=green&size=30&msg=welcome+user
  1. background-color: blue, font-size: 20px, padding: 10px, color: white
  2. background-color: green, font-size: 30px, padding: 20px, color: white
  3. background-color: blue, font-size: 20px, padding: 30px, color: green
  4. background-color: green, font-size: 30px, padding: 10px, color: white
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 48MCQ3 marks
Comprehension passage for this question
Consider the following flask application and html template. Assume that the Flask app is running at http://127.0.0.1:5000. question figure Based on the above data, answer the given subquestions. question figure
What will be the rendered output on the browser for the URL: http://127.0.0.1:5000/?color=green&size=30&msg=welcome+user
  1. question figure
    text
    HELLO USER
  2. question figure
    text
    HELLO USER
  3. question figure
    text
    WELCOME USER
  4. question figure
    text
    WELCOME USER
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 49MSQ3 marksselect all that apply
Which of the following statements correctly differentiates between synchronous and asynchronous updates in frontend development?
  1. In synchronous updates, the UI waits for the operation to complete, while in asynchronous updates, the UI remains responsive.
  2. Synchronous execution is blocking, whereas asynchronous execution is non- blocking.
  3. Asynchronous updates are preferred for network requests and background tasks, while synchronous is best for quick operations.
  4. Both synchronous and asynchronous updates allow the browser to continue execution without waiting.
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 50MCQ3 marks
question figure
Text of the picture (copyable)
Match the type of update with the correct analogy/description:

| Update Type             | Analogy/Description                                                      |
| :---------------------- | :----------------------------------------------------------------------- |
| 1. Synchronous Updates  | A. Runs tasks one after another, without parallel execution              |
| 2. Asynchronous Updates | B. Freezes the UI until the operation is complete                        |
| 3. Blocking Execution   | C. Ordering food at a restaurant and waiting in line until it is ready   |
| 4. Non-blocking Execution | D. Ordering food, receiving a buzzer, and waiting at a table until it rings |
|                         | E. Allows other tasks to continue while waiting for a response           |
  1. 1 → C, 2 → D, 3 → B, 4 → A
  2. 1 → B, 2 → A, 3 → D, 4 → C
  3. 1 → A, 2 → B, 3 → E, 4 → C
  4. 1 → C, 2 → D, 3 → B, 4 → E
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 51MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Given the following test code:

```python
def test_about(client):
    response = client.get('/about')
    assert response.status_code == 200
    assert b'This is the about page.' in response.data
```

Assume the client fixture works correctly and you are testing a Flask route `/about` that should return the text "This is the about page.". Which of the following options would cause this test to fail?
  1. text
    The route `/about` is missing in `app.py`.
  2. text
    The route `/about` exists but returns "About us page" instead.
  3. text
    The route `/about` returns `<p>this is the about page.</p>` instead of plain text.
  4. None of these.
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 52MCQ3 marks
Comprehension passage for this question
A Household Services Application maintains the following three tables: question figure The Requests table represents service bookings made by customers. Based on the above data, answer the given subquestions. question figure question figure
Which SQL query correctly retrieves the customer names and the services they requested?
  1. question figure
    text
    ```sql
    SELECT c.name, s.service_name
    FROM customers c, services s
    WHERE c.id = s.id;
    ```
  2. question figure
    text
    ```sql
    SELECT c.name, r.status
    FROM customers c
    JOIN services s ON c.id = s.id;
    ```
  3. question figure
    text
    ```sql
    SELECT c.name, s.service_name
    FROM customers c
    JOIN requests r ON c.id = r.customer_id
    JOIN services s ON r.service_id = s.id;
    ```
  4. question figure
    text
    ```sql
    SELECT c.name, s.service_name
    FROM services s
    LEFT JOIN customers c ON s.id = c.id;
    ```
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 53MCQ3 marks
Comprehension passage for this question
A Household Services Application maintains the following three tables: question figure The Requests table represents service bookings made by customers. Based on the above data, answer the given subquestions. question figure question figure
Which query finds the number of service requests made by each customer?
  1. question figure
    text
    ```sql
    SELECT r.customer_id, COUNT(*) AS total_requests
    FROM requests r;
    ```
  2. question figure
    text
    ```sql
    SELECT c.name, COUNT(r.service_id) AS total_requests
    FROM customers c
    JOIN requests r ON c.id = r.customer_id
    GROUP BY c.name;
    ```
  3. question figure
    text
    ```sql
    SELECT c.name, COUNT(s.id) AS total_requests
    FROM customers c
    JOIN services s ON c.id = s.id
    GROUP BY c.name;
    ```
  4. question figure
    text
    ```sql
    SELECT c.name, r.service_id
    FROM customers c
    JOIN requests r ON c.id = r.customer_id;
    ```
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 54MCQ2 marks
Comprehension passage for this question
A Household Services Application maintains the following three tables: question figure The Requests table represents service bookings made by customers. Based on the above data, answer the given subquestions. question figure question figure
If the given tables are mapped to Flask-SQLAlchemy models (Customer, Service, Request), which query correctly retrieves all services requested by customer with id=1?
  1. question figure
    text
    ```python
    customer = Customer.query.filter_by(id=1).first()
    services = Service.query.all()
    ```
  2. question figure
    text
    ```python
    services = Service.query.filter_by(customer_id=1).all()
    ```
  3. question figure
    text
    ```python
    customer = Customer.query.get(1)
    services = [r.service for r in customer.requests]
    ```
  4. question figure
    text
    ```python
    services = Request.query.filter_by(id=1).all()
    ```
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 55MCQ2 marks
What does the following curl command do? question figure
Text of the picture (copyable)
```
curl -X POST -d "username=student&password=1234" https://student/login
```
  1. Sends a POST request to retrieve data.
  2. Sends a POST request to send form data.
  3. Sends a POST request to send JSON data.
  4. Sends a POST request to retrieve JSON data.
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 56MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following HTML5 form:

```html
<form method="POST" action="/submit">
    <input type="email" name="email" required>
    <input type="password" name="password" required minlength="8">
    <input type="number" name="age" min="18" max="65" required>
    <button type="submit">Submit</button>
</form>
```

Which of the following attributes are HTML5 native validation features that work without JavaScript?
  1. required, minlength, and type="email"
  2. min, max, and minlength
  3. required, type="password", and action
  4. type="email", min, max, minlength, and required
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 57MSQ5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following Flask-RESTful code:

```python
class UserResource(Resource):
    def get(self, user_id=None):
        if user_id:
            return {"message": "User details", "id": user_id}, 200
        return {"message": "All users"}, 200

    def post(self):
        return {"message": "User created"}, 201

api.add_resource(UserResource, '/users', '/users/<int:user_id>')
```

Which of the following requests will execute successfully?
  1. GET /users - returns 200 with all users
  2. GET /users/5 - returns 200 with user details for ID 5
  3. POST /users - returns 201 with user created message
  4. POST /users/5 - returns 201 with user created message
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 58MCQ3 marks
question figure
Text of the picture (copyable)
In a Flask-Login protected route below:

```python
@app.route('/dashboard')
@login_required
def dashboard():
    return f"Welcome {current_user.username}"
```

What happens when an unauthenticated user tries to access /dashboard?
  1. Returns a 404 error
  2. Displays "Welcome None"
  3. Redirects to the login page
  4. Returns an error page with HTTP 403
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 59MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following code:
app.py

```python
from flask import Flask
app = Flask(__name__)

@app.route("/")
def port():
    return "This is the port question."

if __name__ == "__main__":
    app.run(port=5008)
```

You are running a Flask web application locally using the command: python app.py. On which URL will the application be accessible on the browser?
  1. question figure
    text
    http://127.0.0.1:5000/
  2. question figure
    text
    http://localhost:0000/
  3. question figure
    text
    http://0.0.0.0:5000/
  4. question figure
    text
    http://localhost:5008/
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 60MCQ3 marks
question figure
Text of the picture (copyable)
Which of the following Flask view functions will return a 404 error for the URL:
```
http://127.0.0.1:5000/profile/user123/active/2024?
```
  1. question figure
    text
    ```python
    @app.route('/profile/<username>/<status>/<int:year>')
    def profile(username, status, year):
        info = {'username': username, 'status': status, 'year': year}
        return info
    ```
  2. question figure
    text
    ```python
    @app.route('/profile/<string:username>/<string:status>/<string:year>')
    def profile(username, status, year):
        info = {'username': username, 'status': status, 'year': year}
        return info
    ```
  3. question figure
    text
    ```python
    @app.route('/profile/<username>/<status>/<year>')
    def profile(username, status, year):
        info = {'username': username, 'status': status, 'year': year}
        return info
    ```
  4. question figure
    text
    ```python
    @app.route('/profile/user/<username>/<status>/<year>')
    def profile(username, status, year):
        info = {'username': username, 'status': status, 'year': year}
        return info
    ```