MAD Study Hub

Home / MAD1 / Week 7 / Real questions

MAD1 week 7 - 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 1MSQ5 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 2MCQ5 marks
Consider the following Flask application structure and code. question figure Which of the following statements about the template rendering behavior is correct? question figure
Text of the picture (copyable)
```
my_app/
├── app.py
├── views/
│   └── index.html
├── templates/
│   ├── base.html
│   └── page.html
└── my_templates/
    ├── public/
    │   └── home.html
    └── private/
        └── dashboard.html
```
app.py:
```python
from flask import Flask, render_template

app = Flask(__name__, template_folder='my_templates')

@app.route('/')
def home():
    return render_template('public/home.html')

@app.route('/dashboard')
def dashboard():
    return render_template('private/dashboard.html')

@app.route('/view')
def view():
    return render_template('index.html')

@app.route('/page')
def page():
    return render_template('page.html')

if __name__ == '__main__':
    app.run(debug=True)
```
  1. All routes will work correctly as Flask searches both and
    text
    templates/
    ```
    my_templates/
    ```
  2. Only and routes work, while and routes fail with Error
    text
    /dashboard
    /view
    The image contains a single, small, blurry, diagonal line. It appears to be a checkmark or a slash, but its exact nature is unclear due to the low resolution.
    /page
    TemplateNotFound
  3. The and routes work, while and fail with Error
    text
    The image contains a single, small, blurry, diagonal line. It appears to be a checkmark or a slash, but its exact nature is unclear due to the low resolution.
    /dashboard
    /view
    /page
    TemplateNotFound
  4. All routes fail because Flask requires templates to be in a default folder
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 3MCQ4 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 4SA2 marks
A magnetic disk can spin only in one direction with a constant speed of 6000rpm. What is the maximum delay (worst-case latency) before data transfer starts (in milliseconds)?
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 5MSQ4 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 6SA3 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 7MCQ3 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 8MSQ3 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 9MCQ5 marks
Consider the following HTML and CSS code. question figure Which of the following will be the correct rendered output ?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<head>
<style>
.container{
    display: flex;
    width: 250px;
    border: 2px solid black;
}
.box{
    width: 80px;
    height: 40px;
    border: 1px solid blue;
    margin: 5px;
    text-align: center;
}
</style>
</head>
<body>
<div class="container">
    <div class="box">1</div>
    <div class="box">2</div>
    <div class="box">3</div>
</div>
</body>
</html>
```
  1. question figure
    text
    This is a diagram showing three rectangular boxes stacked vertically within a larger outer rectangle. Each inner box is outlined in blue and contains a single number.
    - The top box is labeled "1".
    - The middle box is labeled "2".
    - The bottom box is labeled "3".
  2. question figure
    text
    This is a diagram of a rectangle with a nested rectangle.
    The outer rectangle is black.
    The inner rectangle is blue.
    Inside the inner rectangle, the text "1 2 3" is displayed.
  3. question figure
    text
    This is a diagram of three rectangular boxes arranged horizontally, each containing a number.
    - The first box on the left contains the number "1".
    - The second box in the middle contains the number "2".
    - The third box on the right contains the number "3".
    All boxes are outlined with a dark blue border, and the vertical lines separating the boxes are also dark blue.
  4. question figure
    text
    The image displays a diagram with a black rectangular outer border. Inside this border, there are three smaller, identical rectangular boxes arranged horizontally. Each of these inner boxes has a blue border. The boxes are labeled with numbers: "1" in the leftmost box, "2" in the middle box, and "3" in the rightmost box. There is a small gap between each of the inner boxes.
MAD1 End Term · 10 May 2026 · open the full paper
Practice 10MCQ2 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 11MCQ2 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 12MSQ3 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 13MSQ3 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 14MCQ3 marks
Consider the following HTML/CSS code. question figure Read the following statements about “index.html” and choose the correct option. Statement 1: Internal element selector blue will be overridden by ID selector red. Statement 2: Internal ID selector red will be overridden by inline styling green.
Text of the picture (copyable)
File name: index. html

```html
<!DOCTYPE html>
<html lang="en">
<style>
    p{
        color: blue;
    }
    #mypara{
        color: red;
    }
</style>
<body>
    <p id="mypara" style="color: green">IIT BS Degree</p>
</body>
</html>
```
  1. Both statements are incorrect.
  2. Both statements are correct.
  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 15MCQ3 marks
Consider the following graph that represents the variation in bandwidth of a network for an entire day (24 hours). Three users were connected to the network at three different times of the day. What is the total data consumed in GigaBytes by all the users in 24 hrs? question figure
Text of the picture (copyable)
This is a 2D line graph with a horizontal x-axis labeled "Time (Hours)" and a vertical y-axis labeled "BandWidth" with units "Megabits/s".

The x-axis ranges from 0 to 24, with major ticks at 0, 4, 8, 12, 14, 16, 20, and 24.
The y-axis ranges from 0 to 12, with major ticks at 0, 2, 4, 6, 8, 10.

There is an orange step-function line graph representing bandwidth over time.
- From 0 to 4 hours, bandwidth is 8 Megabits/s.
- From 4 to 8 hours, bandwidth is 10 Megabits/s.
- From 8 to 12 hours, bandwidth is 6 Megabits/s.
- From 12 to 16 hours, bandwidth is 8 Megabits/s.
- From 16 to 20 hours, bandwidth is 2 Megabits/s.
- From 20 to 24 hours, bandwidth is 4 Megabits/s.

Additionally, there are three horizontal lines with labels indicating user activity:
- A blue line labeled "user 1" extends from 0 to 4 hours at an unspecified y-value (visually above 10).
- A yellow line labeled "user 2" extends from 8 to 14 hours at an unspecified y-value (visually above 10).
- A green line labeled "user 3" extends from 16 to 24 hours at an unspecified y-value (visually above 10).

Vertical dashed lines extend from the x-axis ticks at 4, 8, 12, 14, 16, 20, and 24 hours up to the top of the graph.
  1. 547.2 GB
  2. 12 GB
  3. 43.2 GB
  4. 345.6 GB
MAD1 End Term · 10 May 2026 · open the full paper
Practice 16MCQ4 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 17MCQ4 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 18MCQ5 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 19MCQ5 marks
Examine the following Python code snippet. question figure What will be the output when running the command: ?
Text of the picture (copyable)
File: app_logger.py

```python
import logging
import sys

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s - %(levelname)s - %(message)s')


def calculate(num):
    logging.debug("Calculation initialized")
    logging.info("Input number: %d", num)

    if num == 0:
        logging.warning("Zero detected - cannot process")
        return None
    elif num > 100:
        logging.error("Number exceeds limit: %d", num)
        return None
    else:
        result = num * 2
        logging.info("Calculation succeeded")
        return result


try:
    input_num = int(sys.argv[1])
    result = calculate(input_num)
    if result:
        print(f"Result: {result}")
except IndexError:
    logging.critical("No argument supplied")
except ValueError:
    logging.error("Argument is not numeric")
```
```
python app_logger.py 150
```
  1. question figure
    text
    ```
    2024-07-29 10:20:15,234 - DEBUG - Calculation initialized
    2024-07-29 10:20:15,235 - INFO - Input number: 150
    2024-07-29 10:20:15,236 - ERROR - Number exceeds limit: 150
    ```
  2. question figure
    text
    ```
    2024-07-29 10:20:15,235 - INFO - Input number: 150
    2024-07-29 10:20:15,236 - ERROR - Number exceeds limit: 150
    ```
  3. question figure
    text
    ```
    2024-07-29 10:20:15,235 - WARNING - Zero detected - cannot process
    2024-07-29 10:20:15,236 - ERROR - Number exceeds limit: 150
    ```
  4. question figure
    text
    ```
    2024-07-29 10:20:15,235 - INFO - Input number: 150
    2024-07-29 10:20:15,236 - DEBUG - Calculation succeeded
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 20SA2 marks
A magnetic disk can spin only in one direction with a constant speed of 5000rpm. What is the maximum delay(worst-case latency) before data transfer starts (in milliseconds)?
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 21MCQ2 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 22MCQ3 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
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 23MSQ2 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 24MCQ4 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 25MCQ4 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 26MSQ5 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 27MSQ5 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 28MCQ4 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 29MCQ5 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 30MCQ3 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 31MCQ3 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 32MCQ2 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 33MSQ2 marksselect all that apply
Which of the following statements about HTML, CSS, and character encoding is/are true?
  1. UTF-8 is a variable-length encoding that can represent all Unicode characters.
  2. In HTML, attribute names are case-insensitive.
  3. Inline CSS is preferred over external CSS for large-scale projects.
  4. UTF-32 is a fixed-length encoding where each character takes 4 bytes.
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 34MSQ2 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 35MCQ4 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 36MSQ5 marksselect all that apply
Comprehension passage for this question
Based on the above data, answer the given subquestions. question figure
Which of the following statements is/are correct ?
  1. For the command: python file.py find 103 , the terminal output is:question figure
    text
    Student not found!
  2. For the command: python file.py find 103 , the terminal output is:question figure
    text
    Student found: Dhawan
  3. For the command: python file.py find 104 sid , the terminal output is:question figure
    text
    ```
    IndexError: list index out of range
    ```
  4. For the command: python file.py find 102 , the terminal output is:question figure
    text
    Student found: Anant
  5. For the command: python file.py find 104 sid , the terminal output is:question figure
    text
    Student found: Veda
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 37MCQ3 marks
question figure
Text of the picture (copyable)
What will be the output of the following code?
```html
<script>
  function greet(name = "Guest") {
    return "Hello, " + name;
  }
  console.log(greet());
  console.log(greet("Alice"));
</script>
```
  1. question figure
    text
    Hello, Guest
    Hello, Alice
  2. question figure
    text
    ```
    Hello, undefined
    Hello, Alice
    ```
  3. question figure
    text
    ```
    Hello, Guest
    '[object console]'
    ```
  4. Error: Missing argument
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 38MSQ3 marksselect all that apply
Which statements about frontend and backend validation are TRUE?
  1. Frontend validation (HTML5/JavaScript) is sufficient for security
  2. Frontend validation improves user experience by providing immediate feedback
  3. Backend validation is mandatory for security because frontend can be bypassed
  4. Backend validation should validate the same constraints as frontend
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 39MCQ3 marks
question figure
Text of the picture (copyable)
Consider this logging setup:

```python
import logging

logging.basicConfig(level=logging.INFO,
                    format='%(levelname)s:%(name)s:%(message)s')

logging.debug("Debug message")
logging.info("Info message")
logging.warning("Warning message")
```

What will be displayed in the output?
  1. All three messages will be displayed
  2. Only the info and warning messages will be displayed
  3. Only the warning message will be displayed
  4. Only the info and debug messages will be displayed
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 40MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following code:

```python
from flask import Flask, request, render_template_string

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def home():
    if request.method == 'POST':
        name = request.form['name']
        template = "Hello, {{ name }}!"
        return render_template_string(template, name=name)
    return '''
        <form method="POST">
            Enter Your Name: <input type="text" name="name">
            <button>Submit</button>
        </form>
    '''

if __name__ == '__main__':
    app.run(debug=True)
```

You are building a Flask web application that takes user input from an HTML form and displays it using Jinja2 templates. Suppose the user runs this app locally and submits the name **Alice** in the form.

Which of the following represents the correct sequence of concepts that occur when the user submits the form with the name **Alice** ?
  1. question figure
    text
    HTML Form Rendering → HTTP 404 Not Found Error → User Submits Form → Flask Routing → Template Rendering
  2. question figure
    text
    User Submits Form (HTTP POST) → Check URL Structure → Network Transfer (Bandwidth & Latency) → Flask Routing
  3. question figure
    text
    User Accesses URL (Form at "/") → User Submits Form (HTTP POST) → Flask Request
    Handling (request.form) → Jinja2 Template Rendering
  4. question figure
    text
    Flask Request Handling → Network Round Trip (RTT) → HTML Table Rendering → Jinja2 Template Rendering
MAD1 End Term · 31 Aug 2025 · open the full paper
Practice 41MCQ3 marks
question figure
Text of the picture (copyable)
What will be displayed when running `python app.py 8080` for the following script?
app.py

```python
import sys

port = int(sys.argv[1]) if len(sys.argv) > 1 else 5000
print(f"Server running on port {port}")
```
  1. question figure
    text
    Error: sys has no attribute argv
  2. question figure
    text
    Server running on port 8080
  3. question figure
    text
    Server running on port 5000
  4. question figure
    text
    ```
    IndexError on sys.argv[1]
    ```
MAD1 End Term · 31 Aug 2025 · open the full paper
Practice 42MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following Flask application structure and code.

```
my_project/
├── app.py
├── views/
│   └── dashboard.html
├── templates/
│   ├── base.html
│   └── home.html
└── custom_templates/
    ├── admin/
    │   └── login.html
    └── user/
        └── profile.html
```

**app.py:**

```python
from flask import Flask, render_template

app = Flask(__name__, template_folder='custom_templates')

@app.route('/')
def home():
    return render_template('home.html')

@app.route('/admin')
def admin_login():
    return render_template('admin/login.html')

@app.route('/profile')
def user_profile():
    return render_template('user/profile.html')

@app.route('/dashboard')
def dashboard():
    return render_template('dashboard.html')

if __name__ == '__main__':
    app.run(debug=True)
```

Which of the following statements about the template rendering behavior is correct?
  1. question figure
    text
    All routes will work correctly as Flask will automatically search in both
    templates/ and custom_templates/ folders
  2. question figure
    text
    Only the /admin and /profile routes will work correctly, while / and /dashboard routes will fail with TemplateNotFound error
  3. question figure
    text
    The / and /dashboard routes will fail with TemplateNotFound error, while
    /admin and /profile routes will work correctly
  4. question figure
    text
    All routes will fail because Flask requires the template folder to be named exactly
    templates
MAD1 End Term · 31 Aug 2025 · open the full paper
Practice 43MCQ4.5 marks
question figure
Text of the picture (copyable)
Examine the following Python code snippet.

File: logger_test.py

```python
import logging
import sys

logging.basicConfig(level=logging.WARNING,
                    format='%(asctime)s - %(levelname)s - %(message)s')

def process_data(num):
    logging.debug("Starting data processing")
    logging.info("Processing number: %d", num)

    if num == 0:
        logging.warning("Zero value detected - potential division by zero")
        return None
    elif num < 0:
        logging.error("Negative number provided: %d", num)
        return None
    else:
        result = 100 / num
        logging.info("Calculation completed successfully")
        return result

try:
    input_num = int(sys.argv[1])
    result = process_data(input_num)
    if result:
        print(f"Result: {result}")
except IndexError:
    logging.critical("No command line argument provided")
except ValueError:
    logging.error("Invalid input - not a number")
```

What will be the output when running the command: python logger_test.py -5 ?
  1. question figure
    text
    ```
    2024-07-29 10:15:32,123 - DEBUG - Starting data processing 2024-07-29
    10:15:32,124 - INFO - Processing number: -5
    2024-07-29 10:15:32,125 - ERROR - Negative number provided: -5
    ```
  2. question figure
    text
    ```
    2024-07-29 10:15:32,124 - WARNING - Zero value detected - potential
    division by zero
    2024-07-29 10:15:32,125 - ERROR - Negative number provided: -5
    ```
  3. question figure
    text
    ```
    2024-07-29 10:15:32,125 - ERROR - Negative number provided: -5
    ```
  4. question figure
    text
    ```
    2024-07-29 10:15:32,124 - INFO - Processing number: -5
    2024-07-29 10:15:32,125 - ERROR - Negative number provided: -5
    2024-07-29 10:15:32,126 - INFO - Calculation completed successfully
    ```
MAD1 End Term · 31 Aug 2025 · open the full paper
Practice 44MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following Flask app code.

```python
from flask import Flask
from flask_restful import Resource, Api

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

class MyApiResource(Resource):
    def get(self):
        return {"response": "GET"}, 200

    def post(self, value):
        return {"response": "POST", "value": value}, 200

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

if __name__ == "__main__":
    app.run(debug=True)
```

The above flask app is running on "http://127.0.0.1:5000". Which of the following commands will return a runtime error?
  1. question figure
    text
    ```
    curl http://127.0.0.1:5000/1025 -X GET
    ```
  2. question figure
    text
    ```
    curl http://127.0.0.1:5000/1025 -X POST
    ```
  3. question figure
    text
    ```
    curl http://127.0.0.1:5000/ -X POST
    ```
  4. question figure
    text
    ```
    curl http://127.0.0.1:5000/ -x GET
    ```
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 45MCQ2 marks
You manage a datacenter where each server has a 10 Gigabit per second network connection and the facility’s backbone link is also 10 Gbps. Your application is handling 10,000 requests per second, each with a 50 KB response, which translates to about 4 Gbps of required throughput. So, if each request involves minimal CPU processing, and the existing server has sufficient resources to handle the load. Which of the following scaling strategies is most appropriate to meet this demand?
  1. Scale up on a single server
  2. Scale out to multiple servers in the datacenter
  3. Both will produce similar results
  4. None of these
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 46MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following table "ExamScores" in the SQLite database.

| id | score |
|----|-------|
| 1  | 57    |
| 2  | 98    |
| 3  | 83    |

Which of the following Python statements will print the maximum score value?
  1. question figure
    text
    ```python
    >>> print(db.session.query.max(ExamScores.score))
    ```
  2. question figure
    text
    ```python
    >>> print(db.session.query(func.max(ExamScores.score)).scalar())
    ```
  3. question figure
    text
    ```python
    >>> print(db.session.query(func.max(ExamScores.score)))
    ```
  4. question figure
    text
    ```python
    >>> print(db.session.query.max(ExamScores.score).scalar())
    ```
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 47MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Flask and HTML implementations.

Flask file: main.py

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

@app.route("/text/size/<int:size>/<color>")
def set_size(size, color):
    style = {"font-size": str(size) + "px", "color": color}
    return render_template("index.html", css_style=style)

app.run(debug=True)
```

HTML file: index.html

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

Assume that the Flask code is running on the server http://127.0.0.1:5000 without any errors.
Choose the correct URL to render the output below.

IITM BS Degree Program
  1. question figure
    text
    http://127.0.0.1:5000?text=red&size=20
  2. question figure
    text
    ```
    http://127.0.0.1:5000?size=20&text=red
    ```
  3. question figure
    text
    ```
    http://127.0.0.1:5000/text/size/red/20
    ```
  4. question figure
    text
    ```
    http://127.0.0.1:5000/text/size/20/red
    ```
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 48MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Flask app code.

```python
from flask import Flask, request

valid_users = [
    {"uid": "student", "pwd": "12345"},
    {"uid": "professor", "pwd": "54321"},
    {"uid": "hod", "pwd": "abcde"},
]

app = Flask(__name__)

@app.route("/signin")
def login():
    args = request.args
    for vu in valid_users:
        if vu["uid"] == args["uid"] and vu["pwd"] == args["pwd"]:
            return "You are authorized!!"
    else:
        return "You are unauthorized!!"

app.run(debug=True)
```

Assume the above flask app runs on "http://127.0.0.1:5000/" and is accessed through the web browser. What will be the output for the URL: "http://127.0.0.1:5000/signin?uid=professor&pwd=54321" ?
  1. You are authorized!!
  2. You are unauthorized!!
  3. Not Found
  4. Internal Server Error
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 49MCQ4.5 marks
question figure question figure
Text of the picture (copyable)
Consider the following HTML code.
Filename: main.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Greetings</title>
</head>
<body>

    <button onclick="alert('Hello, welcome')">Greet1!</button><br>
    <button onclick="console.log('Hello, welcome')">Greet2!</button><br>
    <button onclick="document.write('Hello, welcome')">Greet3!</button><br>
    <button onclick="console.error('Hello, welcome')">Greet4!</button>

</body>
</html>
```
Rendered HTML output below:

[Greet1!] (button)
[Greet2!] (button)
[Greet3!] (button)
[Greet4!] (button)

Which of the above “Greet” buttons will print greetings on the dialogue box?
  1. Greet4
  2. Greet3
  3. Greet2
  4. Greet1
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 50MSQ3 marksselect all that apply
Which of the following statements is/are false about caching in REST APIs?
  1. Caching allows storing server responses in a proxy or frontend so that a clientneed not make requests to the server for the same resources repeatedly.
  2. Caching degrades the overall quality of service and increases load on theservers.
  3. Browsers treat all GET and POST requests cacheable by default.
  4. Caching optimizes the network by increasing the latency.
MAD1 Quiz 2 · 03 Aug 2025 · open the full paper
Practice 51MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the Flask Restful API code given below:
File name: app.py

```python
from flask import Flask, request
from flask_restful import Resource, Api

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

class APICalculator(Resource):
    def post(self):
        d = request.json
        a = int(d["val1"])
        b = int(d["val2"])
        oper = d["operator"]
        if oper == "+":
            return {"Sum": (a + b)}, 200
        elif oper == "-":
            return {"Difference": (a - b)}, 200
        elif oper == "*":
            return {"Product": (a * b)}, 200
        else:
            return {"Error": "Invalid option"}, 401

api.add_resource(APICalculator, "/")

app.run(debug=True)
```

Assume that the Flask server is running on http://127.0.0.1:5000. Which of the following is the correct curl command(s) that will return calculated values?
**Note: Assume data sent is valid for cmd, and powershell**
  1. question figure
    text
    ```
    curl -X POST "http://127.0.0.1:5000" -H 'Content-Type: application/json' -d '{"val1":27, "val2":3, "operator":"+"}'
    ```
  2. question figure
    text
    ```
    curl -X POST "http://127.0.0.1:5000" -H 'Content-Type: application/json' -d
    '{"val1":27,"val2":3,"operator":"**"}'
    ```
  3. question figure
    text
    ```
    curl -X POST "http://127.0.0.1:5000" -H 'Content-Type: application/json' -d '{"val1":27,"val2":3,"operator":"/"}'
    ```
  4. question figure
    text
    ```
    curl -X POST "http://127.0.0.1:5000" -d
    '{"val1":27, "val2":3, "operator":"/"}'
    ```
  5. question figure
    text
    ```
    curl -X POST "http://127.0.0.1:5000" -H 'Content-Type: application/json' -d '{"val1":27, "val2":3, "operator":"-"}'
    ```
MAD1 Quiz 1 · 13 Jul 2025 · open the full paper
Practice 52MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML code snippet.

filename: index.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>CSS Document</title>
    <style>
        .container p.highlight { background-color: red; }
        .content .special { background-color: blue; }
        span.highlight { background-color: green; }
    </style>
</head>
<body>
    <div class="container">
        <p class="highlight">Welcome to our site</p>
        <div class="content">
            <p>This is regular content</p>
            <p class="highlight special">Important information</p>
            <span class="highlight">Notice</span>
        </div>
        <p class="highlight">Footer text</p>
    </div>
    <p class="highlight">Welcome to our site</p>
</body>
</html>
```

Which elements from the above document will have a red background color?
  1. question figure
    text
    All elements with the class "highlight".
  2. question figure
    text
    Only the `<p>` elements that are direct children of `.container` and have the class "highlight"
  3. question figure
    text
    All `<p>` elements with the class "highlight" that are descendants of `.container`
  4. question figure
    text
    Only the first `<p>` element with class "highlight"
MAD1 Quiz 1 · 13 Jul 2025 · open the full paper
Practice 53MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Flask code snippet:

```python
from flask import Flask, url_for, request, redirect
app = Flask(__name__)

@app.route("/signin/user")
def login():
    return url_for("login")

@app.route("/")
def home():
    return redirect(url_for("login"))

app.run(debug=True)
```

Assume the above code is running on server http://127.0.0.1:5000/ . What will be the output on a web browser for the URL: http://127.0.0.1:5000/ ?
  1. question figure
    text
    http://127.0.0.1:5000/signin/user
  2. question figure
    text
    /signin/user
  3. question figure
    text
    http://127.0.0.1:5000
  4. question figure
    text
    Not Found
MAD1 Quiz 1 · 13 Jul 2025 · open the full paper
Practice 54SA3 marks
We want to use an online grammar checking tool, which takes each word from the client and sends it to the web server. The available network bandwidth between the client and the server is 2 Gbps. What should be the maximum allowed size(in MBs) of a document containing the word sent from the client to the server per second for the grammar check? (Use: 1KB= 1000Bytes, 1MB=1000KB and so on.)
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 55MCQ3 marks
question figure
Text of the picture (copyable)
A Flask application and its absolute path is given below.

C:\home\mad_1>

**app.py**

```python
from flask import Flask, url_for
import sys

def create_path():
    if len(sys.argv) < 2:
        return '/static'
    else:
        return f'/{sys.argv[1]}'

app = Flask(__name__, static_url_path = create_path())

@app.route('/home')
def display():
    return f"<h3>static url path: {app.static_url_path}</h3>\
           <h3>static folder: {app.static_folder}</h3>"

app.run(debug = True)
```

If the application is run locally on http://127.0.0.1:5000 using the command python app.py stable, what will be rendered by the browser for URL http://127.0.0.1:5000/home?
  1. question figure
    text
    static url path: C:\home\mad_1\static
    static folder: /static
  2. question figure
    text
    static url path: /static
    static folder: C:\home\mad_1\static
  3. question figure
    text
    static url path: /stable
    static folder: C:\home\mad_1\stable
  4. question figure
    text
    static url path: /stable
    static folder: C:\home\mad_1\static
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 56MCQ3 marks
A Server S needs to retrieve data from two datacenters D1 and D2 located at 1500 kilometres and 3000 kilometres respectively. Server S and D1 are connected via medium M1 through which information can be transferred with the speed of 1.5×108 m/sec, and server S and D2 are connected via medium M2. If the server received data from both the data centres at the same time, what must be the speed of information transfer in medium M2(overheads should be ignored)? (Concept: Performance parameters of a network)
  1. question figure
    text
    1.5 x 10^8 m/sec
  2. question figure
    text
    2 × 10⁸ m/sec
  3. question figure
    text
    2.7 × 10⁸ m/sec
  4. question figure
    text
    3 × 10⁸ m/sec
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 57MCQ3 marks
question figure
Text of the picture (copyable)
A mobile server and a client initially 1000 km apart are moving towards each other
in a straight line with the speeds of 180 kmph and 70 kmph respectively. The network
bandwidth is set constant to 3 Mbps. Determine how much data (in Gigabytes) is used
by the client before the client and the server collide. [speed of light in vacuum: 3 x 10⁸
m/sec, 1 MB = 1000 KB and so on.]
  1. 64.8
  2. 18
  3. 5.4
  4. 22.5
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 58MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following flask code.

```python
from flask import Flask, redirect, url_for
app = Flask(__name__)

@app.route('/admin')
def hello_admin():
    return 'Hello Admin'

@app.route('/guest/<guest>')
def hello_guest(guest):
    return f'Hello {guest}'

@app.route('/user/<name>')
def hello_user(name):
    if name == 'admin':
        return redirect(url_for('hello_admin'))
    else:
        return redirect(url_for('hello_guest', guest=name))

if __name__ == '__main__':
    app.run(debug=True)
```

Match the commands in Column A with their correct rendered output in Column B

| Column A | Column B |
|---|---|
| 1. http://127.0.0.1:5000/user/admin | a. Hello mad1 |
| 2. http://127.0.0.1:5000/admin | b. Hello Admin |
| 3. http://127.0.0.1:5000/guest/mad1 | c. /admin |
| 4. http://127.0.0.1:5000/user/mad1 | d. /guest/mad1 |
  1. 1-c, 2-b, 3-a, 4-d
  2. 1-c, 2-d, 3-a, 4-b
  3. 1-b, 2-a, 3-b, 4-d
  4. 1-b, 2-b, 3-a, 4-a
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 59MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following route in the flask for a signup page and select the correct option:

```python
@app.route('/signup', methods=['GET', 'POST'])
def signup():
    if request.method == 'GET':
        return """<form action='/signup' method='POST'>
            <label for='username'>Username</label>
            <input type='text' name='username' required>
            <label for='password'>Password</label>
            <input type='text' name='password' required minlength="8">
            <input type='submit' value='Submit'>
        </form>
        """
    if request.method == 'POST':
        if request.form.get('username') is None:
            return redirect(url_for(signup))
        if request.form.get('password') is None:
            return redirect(url_for(signup))
        if len(request.form.get('password')) < 8:
            return redirect(url_for(signup))
        return f"<h1>Welcome, {request.form.get('username')}!</h1>"
```
  1. The signup page is dynamically generated.
  2. The signup page uses server-side rendering.
  3. The signup page uses frontend validation.
  4. The signup page uses backend validation.
MAD1 End Term · 13 Apr 2025 · open the full paper
Practice 60MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
The following Flask-RESTful API code snippet is intended to create a RESTful API for managing student registrations in an IITM BS degree program. However, there is an error in the code that prevents it from functioning correctly.

```python
from flask import Flask, jsonify, request
from flask_restful import Api, Resource

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

students = []

class Student(Resource):
    def get(self, student_id):
        for student in students:
            if student["id"] == student_id:
                return jsonify(student)
        return jsonify({"message": "Student not found"}), 404

    def post(self):
        data = request.get_json()
        new_student = {
            "id": data["id"],
            "name": data["name"]
        }
        students.append(new_student)
        return jsonify({"message": "Student added successfully"})

api.add_resource(Student, "/student/<int:student_id>")

if __name__ == "__main__":
    app.run(debug=True)
```

**Error:**
When trying to use the **POST** method to add a student, it throws a **TypeError** stating that the route does not match the method. Identify the correct option to fix the error in the code.
  1. question figure
    text
    Change the api.add_resource(Student, "/student/<int:student_id>") to:
    ```
    api.add_resource(Student, "/student", "/student/<int:student_id>")
    ```
  2. question figure
    text
    Add the student_id parameter to the **post** method in the Student class as **def**
    ```
    post(self, student_id):
    ```
  3. question figure
    text
    Replace the **post** method with the following route in the Student class:
    
    ```python
    def post(self):
        data = request.get_json()
        new_student = {
            "id": len(students) + 1,
            "name": data["name"]
        }
        students.append(new_student)
        return jsonify({"message": "Student added successfully"}), 201
    ```
  4. question figure
    text
    Change the api.add_resource(Student, "/student/<int:student_id>") to:
    api.add_resource(Student, "/students")