MAD Study Hub

Home / Past papers / MAD1 Quiz 1 / this paper

IIT M DIPLOMA AN EXAM QDD3 13 July 2025 - 13 Jul 2025

MAD1 Quiz 116 questions50 marks13 MCQ · 2 SA · 1 MSQDiploma / afternoon / QDD3
Elapsed 00:00
Q1MCQ2 marks
question figure
Text of the picture (copyable)
What will be the output of the following HTML code?

```html
<!DOCTYPE html>
<html>
<head>
    <title>Test List</title>
</head>
<body>
    <dl>
        <dt>Flask</dt>
        <dd>A Python web framework.</dd>
        <dt>SQLAlchemy</dt>
        <dd>A database toolkit for Python.</dd>
    </dl>
</body>
</html>
```
  1. question figure
    text
    Flask
        A Python web framework.
    SQLAlchemy
        A database toolkit for Python.
  2. question figure
    text
    Flask
    A Python web framework.
    SQLAlchemy
    A database toolkit for Python.
  3. question figure
    text
    Flask
     - A Python web framework.
    SQLAlchemy
     - A database toolkit for Python.
  4. question figure
    text
    Flask
    A Python web framework.
    SQLAlchemy
    A database toolkit for Python.
Q2MCQ2 marks
question figure
Text of the picture (copyable)
Mayur and Manoj are playing a friendly cricket match. You are building a Flask web application to display their scores. Which of the following Flask route functions will correctly display the score when the user visits http://127.0.0.1/score ?(Assume that the score.html exists)
  1. question figure
    text
    ```python
    @app.route('/score')
    def score():
        return render('score.html', mayur=50, manoj=45)
    ```
  2. question figure
    text
    ```python
    @app.route('/score')
    def score():
        return render_template('score.html', mayur=50, manoj=45)
    ```
  3. question figure
    text
    ```python
    def score():
        return render_template('score.html', mayur=50, manoj=45)
    @app.route('/score')
    ```
  4. question figure
    text
    ```python
    @app.route('/score')
    def score():
        return 'score.html', mayur=50, manoj=45
    ```
Q3MCQ3 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"
Q4MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

Filename: code.py

```python
from string import Template as string_template
from jinja2 import Template as jinja_template

template1 = string_template('Hello $name, welcome to $city!')
template2 = jinja_template('{{product}} costs {{price}}')

result1 = template1.substitute(name='Alice')
result2 = template1.substitute(name='Alice', city='Boston',
                               state='Massachusetts')
result3 = template2.render({"product": "laptop"})
result4 = template2.render({"product": "laptop", "price": "45000",
                            "currency": "rupees"})

print(result1)
print(result2)
print(result3)
print(result4)
```

Which of the following statements will throw a key error?
  1. question figure
    text
    ```python
    template1.substitute(name='Alice')
    ```
  2. question figure
    text
    ```python
    template1.substitute(name='Alice', city='Boston', state='Massachusetts')
    ```
  3. question figure
    text
    ```
    template2.render({"product": "laptop"})
    ```
  4. question figure
    text
    ```
    template2.render({"product": "laptop", "price": "45000", "currency": "rupees"})
    ```
Q5MCQ3 marks
question figure
Text of the picture (copyable)
What will be the output of the following Jinja2 template when rendered in Flask?

```html
{% macro greet(name) %}
Hello, {{ name }}!
{% endmacro %}

<!DOCTYPE html>
<html>
<head>
    <title>Jinja2 Macro Test</title>
</head>
<body>
    {{ greet("Alice") }}
    {{ greet("Bob") }}
</body>
</html>
```
  1. question figure
    text
    Hello, Alice! Hello, Bob!
  2. question figure
    text
    ```
    jinja2.exceptions.UndefinedError: 'greet' is undefined
    ```
  3. question figure
    text
    Hello, Alice!
    Hello, Bob!
  4. question figure
    text
    ```
    {{ greet("Alice") }}
    {{ greet("Bob") }}
    ```
Q6MCQ3 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
Q7MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following code:

```html
<!DOCTYPE html>
<html>
<head>
    <style>
        p {
            color: blue;
        }
        #highlight {
            color: green;
        }
        .important {
            color: red;
        }
    </style>
</head>
<body>
    <p class="important" id="highlight">This is a paragraph.</p>
</body>
</html>
```

What will be the color of the paragraph text when rendered in a browser?
  1. Blue
  2. Green
  3. Red
  4. The browser default (black)
Q8MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following Python file "output.py"

File: "output.py"
```python
from jinja2 import Template
output = """<!DOCTYPE html>
<body>
    <ul>
        <!--Missing Jinja2 implementation-->
    </ul>
</body>
</html>
"""

l = [5, 4, 3, 2, 1]
t = Template(output)
output = t.render(sl=l)
print(output)
```

Which of the following code snippet when placed at `<!--Missing Jinja2 implementation-->` will render the below unordered list as shown below?

* 1
* 2
* 3
* 4
* 5
  1. question figure
    text
    ```html
    {%for item in sl|sort(reverse=True)%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  2. question figure
    text
    ```
    {%for item in sl%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  3. question figure
    text
    ```html
    {%for item in s1|sort%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  4. question figure
    text
    ```jinja
    {%for item in sl.sort()%}
        <li>{{item}}</li>
    {%endfor%}
    ```
Q9MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet:
main.py

```python
import sys
def process(v):
    # Missing code 1
    v = sys.argv
    # Missing code 2
    print(output)
```

We are executing above main.py in command line with command `python main.py 1 2 3 4 5`.
Which of the following codes when replaced at #Missing code 1 and #Missing code 2 will render the output below:
**1,2,3,4,5**
  1. question figure
    text
    ```python
    #Missing code 1
    st = ",".join(v)
    return st
    
    #Missing code 2
    output = process(v)
    ```
  2. question figure
    text
    ```python
    #Missing code 1
    st = str(join(v),",")
    return st
    
    #Missing code 2
    output = process(v)
    ```
  3. question figure
    text
    ```python
    #Missing code 1
    st = str(join(v),",")
    return st
    
    #Missing code 2
    output = process(v[1:])
    ```
  4. question figure
    text
    ```python
    #Missing code 1
    st = ",".join(v)
    return st
    
    #Missing code 2
    output = process(v[1:])
    ```
Q10SA3 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.)
Q11SA3 marks
Consider a client which is located 3000 km from the server makes a request through the cable. Suddenly after the request reaches the server, the cable breaks and the response is now to be sent to the client via air. This change of medium caused an additional delay of 47 ms at the server end. How long will the client have to wait before receiving the response (in ms)? ( speed on cable = 2e8 m/s and in air 3e8 m/s)
Comprehension passage - the questions below it refer to this
question figure
Q12MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Which command line input will
produce the output:
flask is a server-side python framework.?
  1. question figure
    text
    ```
    python webapp.py flask python type
    ```
  2. question figure
    text
    ```
    python webapp.py flask type server-side
    ```
  3. question figure
    text
    ```
    python webapp.py flask type
    ```
  4. question figure
    text
    ```
    python webapp.py type flask python
    ```
  5. question figure
    text
    ```
    python webapp.py flask server-side
    ```
Q13MCQ2 marks
question figure
Text of the picture (copyable)
What will be the output for command line input,
```
python webapp.py react type ?
```
  1. question figure
    text
    react is a client-side javascript framework
  2. question figure
    text
    react is a server-side python framework
  3. question figure
    text
    Invalid second argument or Language not found!
  4. question figure
    text
    Invalid command
Q14MCQ2 marks
question figure
Text of the picture (copyable)
What will be the output for command line
input, python webapp.py django python ?
  1. question figure
    text
    django is a client-side javascript framework
  2. question figure
    text
    django is a server-side python framework
  3. question figure
    text
    Invalid second argument or language not found!
  4. question figure
    text
    Invalid command
Comprehension passage - the questions below it refer to this
question figure
Q15MCQ4.5 marks
question figure
Text of the picture (copyable)
The Flask route and template given in
the main data, what will be rendered
in the browser when the user visits
`/protein?gender=FeMaLe&weight=154lb`
  1. question figure
    text
    Recommended Daily Protein Intake
    Gender: male
    Weight: 60kg
    Recommended Intake: **48 grams**
  2. question figure
    text
    Recommended Daily Protein Intake
    
    Gender: FeMaLe
    
    Weight: 154lb
    
    Recommended Intake: **52 grams**
  3. question figure
    text
    Recommended Daily Protein Intake
    
    Gender: FeMaLe
    
    Weight: 154lb
    
    Recommended Intake: **70 grams**
  4. question figure
    text
    Recommended Daily Protein Intake
    
    Gender: female
    
    Weight: 154lb
    
    Recommended Intake: **70 grams**
Q16MCQ3 marks
question figure
Text of the picture (copyable)
The Flask route and template given in
the main data, what will be rendered
in the browser when the user visits
`/protein?gender=FEMALE&weight=60`
  1. question figure
    text
    Recommended Daily Protein Intake
    Gender:
    Weight:
    Recommended Intake: grams
  2. question figure
    text
    Recommended Daily Protein Intake
    
    Gender: FEMALE
    
    Weight: 60
    
    Recommended Intake: **45 grams**
  3. question figure
    text
    Recommended Daily Protein Intake
    Gender: FEMALE
    Weight: 60kg
    Recommended Intake: **45 grams**
  4. question figure
    text
    Recommended Daily Protein Intake
    
    Gender: male
    
    Weight: 60kg
    
    Recommended Intake: **48 grams**

Answer key

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

Concepts this paper tests

Auto-generated summary from the source site. Handy as a checklist; the lessons above explain each idea from scratch.

Summary of Core Topics, Concepts, Principles, and Equations

1. HTML and CSS

2. Flask and Jinja2

3. Python Programming

4. Networking and Data Transfer

5. Mathematical Calculations

Equations

Network Bandwidth Calculation

The relationship between bandwidth, data size, and time is given by: \[ B = \frac{S}{T} \]

Given \( B = 2 \text{ Gbps} = 2 \times 10^9 \text{ bits per second} \) and \( T = 1 \text{ second} \), we can calculate the data size \( S \) in bits: \[ S = B \times T = 2 \times 10^9 \text{ bits} \]

To convert bits to megabytes (MB), we use the conversion factors: \[ 1 \text{ byte} = 8 \text{ bits} \] \[ 1 \text{ KB} = 1000 \text{ bytes} \] \[ 1 \text{ MB} = 1000 \text{ KB} \]

So, \[ S \text{ (in MB)} = \frac{2 \times 10^9 \text{ bits}}{8 \times 10^6 \text{ bits/MB}} = 250 \text{ MB} \]

Network Latency Calculation

The time taken for the signal to travel through the cable is: \[ T_c = \frac{D}{V_c} \]

The time taken for the signal to travel through the air is: \[ T_a = \frac{D}{V_a} \]

The total delay is the sum of the time taken to travel through the cable and the additional delay: \[ T_{total} = T_c + T_d \]

Substituting the values: \[ T_c = \frac{3000 \times 10^3 \text{ m}}{2 \times 10^8 \text{ m/s}} = 15 \text{ ms} \] \[ T_{total} = 15 \text{ ms} + 47 \text{ ms} = 62 \text{ ms} \]

However, the correct answer provided is 72 ms, which suggests there might be additional considerations or a different interpretation of the problem.