MAD Study Hub

Home / MAD1 / Week 2 / Real questions

MAD1 week 2 - 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
Consider the Flask SQLAlchemy data model. question figure What is the output after the following Python code is executed ? (Assume all entries are successfully committed to the database) question figure
Text of the picture (copyable)
```python
class User(db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    mail_id = db.Column(db.String, unique=True)
    password = db.Column(db.String, nullable=False)
```
```python
>>> u1=User(mail_id='abc@gmail.com',password='12345')
>>> u2=User(mail_id='pxyz@gmail.com',password='abcd1234')
>>> u3=User(mail_id='lmn@gmail.com',password='54321')
>>> u4=User(mail_id='opqrst@gmail.com',password='xyz123')
>>> db.session.add_all([u1,u2,u3,u4])
>>> db.session.commit()
>>> result=User.query.filter(User.mail_id.like('p%')).all()
>>> print(len(result))
```
  1. 4
  2. 3
  3. 2
  4. 1
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 2MCQ3 marks
Consider the SQLAlchemy model Order mapped to the table orders. question figure
Text of the picture (copyable)
Table name: orders

| id | cust_id | status | amount |
|---|---|---|---|
| 1 | C101 | PAID | 500 |
| 2 | C102 | PENDING | 1200 |
| 3 | C101 | PAID | 800 |
| 4 | C103 | CANCELLED | 400 |
| 5 | C102 | PAID | 1200 |

Choose the correct SQLAlchemy statements that is similar to the SQL query:

```sql
SELECT * FROM orders where status='PAID' and amount>500;
```
  1. question figure
    text
    ```python
    order_records = db.session.query(Order).filter( \
        Order.status == "PAID" and Order.amount > 500)
    ```
  2. question figure
    text
    ```python
    order_records = db.session.query(Order) \
        .filter(Order.status == "PAID") \
        .filter(Order.amount > 500)
    ```
  3. question figure
    text
    ```python
    order_records = db.session.query(Order).filter( \
        Order.status == "PAID") and \
    db.session.query(Order).filter(Order.amount > 500)
    ```
  4. question figure
    text
    ```python
    order_records = db.session.query(Order.status == "PAID" and \
        Order.amount > 500)
    ```
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 3MCQ3 marks
Consider the following models: Course and Enrollment corresponding to tables course and enrollment in SQLite database. question figure Based on the model schemas, what relationship do the classes Course and Enrollment share?
Text of the picture (copyable)
```python
class Course(db.Model):
    id = db.Column(db.Integer(), primary_key = True)
    title = db.Column(db.String(), unique = True)

class Enrollment(db.Model):
    id = db.Column(db.Integer(), primary_key = True)
    student_id = db.Column(db.String(), nullable = False)
    course_id = db.Column(db.Integer(), db.ForeignKey("course.id"))
```
  1. Many-to-Many
  2. One-to-Many
  3. One-to-One
  4. The tables are not at all related
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 4MCQ3 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 5MCQ3 marks
A recipe webpage needs to display two distinct sections: A list of ingredients where the order does not matter.1. A sequence of cooking steps that must be followed in order.2. Which combination of HTML list container tags is most appropriate for these sections?
  1. text
    Ingredients: <ol> | Cooking Steps: <ol>
  2. text
    Ingredients: `<ul>` | Cooking Steps: `<ul>`
  3. text
    Ingredients: `<d1>` | Cooking Steps: `<u1>`
  4. text
    Ingredients: `<ul>` | Cooking Steps: `<ol>`
MAD1 Quiz 2 · 16 Aug 2026 · open the full paper
Practice 6MCQ5 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 7MCQ4 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 8MSQ4 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 1 · 19 Jul 2026 · open the full paper
Practice 9MCQ2 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 10MCQ2 marks
Which of the following pairs correctly identifies one block-level element and one inline element?
  1. text
    Block: `<span>` | Inline: `<div>`
  2. text
    Block: `<div>` | Inline: `<a>`
  3. text
    Block: `<h1>` | Inline: `<p>`
  4. text
    Block: `<span>` | Inline: `<h5>`
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 11MCQ4 marks
Consider the following Python code. question figure Which of the following code snippets should be placed at such that the output generated in the terminal when rendered will be as shown below? question figure
Text of the picture (copyable)
```python
from jinja2 import Template
output = """
<!DOCTYPE html>
<html>
<body>
    <ul>
        <!--Missing Jinja2 implementation-->
    </ul>
</body>
</html>
"""

l = [6, 8, 5, 2, 4]
t = Template(output)
output = t.render(sl=l)
print(output)
```
```html
<!--Missing Jinja2 implementation-->
```
- 8
- 6
- 5
- 4
- 2
  1. question figure
    text
    ```html
    {%for item in sl|sort(reverse=True)%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  2. question figure
    text
    ```html
    {%for item in sl%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  3. question figure
    text
    ```html
    {%for item in sl|sort%}
        <li>{{item}}</li>
    {%endfor%}
    ```
  4. question figure
    text
    ```
    {%for item in sl.sort()%}
        <li>{{item}}</li>
    {%endfor%}
    ```
MAD1 Quiz 1 · 19 Jul 2026 · open the full paper
Practice 12MCQ5 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 13MCQ2 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 14MCQ2 marks
Consider the following SQL Alchemy model with below data. question figure Which of the following SQL Alchemy statements is used to count the number of students registered for ?
Text of the picture (copyable)
CourseRegistrations
| ID | student_id | course_id | date_of_registration |
|---|---|---|---|
| 1 | S101 | CS101 | 17-10-2024 |
| 2 | S103 | CS101 | 10-10-2024 |
| 3 | S101 | CS201 | 16-10-2024 |
| 4 | S102 | CS101 | 17-10-2024 |
| 5 | S104 | CS201 | 06-10-2024 |
```
course_id="CS101"
```
  1. question figure
    text
    ```python
    count = db.session.query(CourseRegistrations) \
        .filter(course_id == "CS101") \
        .count()
    ```
  2. question figure
    text
    ```python
    count = db.session.query \
        .filter(CourseRegistrations.course_id == "CS101") \
        .count()
    ```
  3. question figure
    text
    ```python
    count = db.query(CourseRegistrations) \
        .filter(course_id == "CS101") \
        .count()
    ```
  4. question figure
    text
    ```python
    count = db.session.query(CourseRegistrations) \
        .filter(CourseRegistrations.course_id == "CS101") \
        .count()
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 15MCQ2 marks
What is the purpose of the primary_key=True attribute in a SQLAlchemy model?
  1. It allows duplicate values in the column
  2. It uniquely identifies each row in the table
  3. It automatically creates foreign key relationships
  4. It makes the column optional
MAD1 End Term · 10 May 2026 · open the full paper
Practice 16MCQ3 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 17MCQ3 marks
Consider the Flask SQLAlchemy data model. question figure
Text of the picture (copyable)
```python
class User(db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    mail_id = db.Column(db.String, unique=True)
    password = db.Column(db.String, nullable=False)
```

What is the output after the following Python code is executed ? (Assume all entries are successfully committed to the database)

```python
>>> u1=User(mail_id='abc@gmail.com',password='12345')
>>> u2=User(mail_id='pxyz@gmail.com',password='abcd1234')
>>> u3=User(mail_id='lmn@gmail.com',password='54321')
>>> u4=User(mail_id='pqrst@gmail.com',password='xyz123')
>>> db.session.add_all([u1,u2,u3,u4])
>>> db.session.commit()
>>> result=User.query.filter(User.mail_id.like('p%')).all()
>>> print(len(result))
```
  1. 1
  2. 2
  3. 3
  4. 4
MAD1 End Term · 10 May 2026 · open the full paper
Practice 18MCQ3 marks
Consider the following csv file. question figure Choose the correct Python code that will print the output: ['90', '76', '81']?
Text of the picture (copyable)
File name: marks.csv

| id | name | course1 | course2 | course3 |
|---|---|---|---|---|
| 1 | Ram Kumar | 90 | 56 | 78 |
| 2 | David John | 67 | 76 | 71 |
| 3 | Sanju | 56 | 61 | 81 |
  1. question figure
    text
    ```python
    import csv
    
    with open("marks.csv") as marks:
        rows = csv.reader(marks)
        next(rows)
        max_m = [max(r[2:]) for r in rows]
        print(max_m)
    ```
  2. question figure
    text
    ```python
    import csv
    
    with open("marks.csv") as marks:
        rows = csv.reader(marks)
        max_m = [max(r) for r in rows]
        print(max_m)
    ```
  3. question figure
    text
    ```python
    import csv
    
    with open("marks.csv") as marks:
        rows = csv.reader(marks)
        next(rows)
        max_m = [max(r[2:]) for r in rows]
        print(max_m)
    ```
  4. question figure
    text
    ```python
    import csv
    
    with open("marks.csv") as marks:
        rows = csv.reader(marks)
        max_m = [max(r) for r in rows]
    print(max_m)
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 19MCQ3 marks
Which of the following is the correct flask_login code snippet to register a user as logged in for the current session?
  1. login_user(user.id)
  2. login_user(user)
  3. login_user(user.name)
  4. login_user(user.name and user.password)
MAD1 End Term · 10 May 2026 · open the full paper
Practice 20MCQ3 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 21MSQ2 marksselect all that apply
Which of the following statements are true in the context of HTML forms?
  1. default type is “submit”.
    text
    ```html
    <button>
    ```
  2. “read-only” inputs are not submitted.
  3. “disabled” inputs are not submitted.
  4. “required” works on
    text
    ```html
    <input type='hidden'>
    ```
MAD1 End Term · 10 May 2026 · open the full paper
Practice 22MSQ2 marksselect all that apply
Which of the following statements are true about DOM?
  1. Changing the DOM value changes the HTML source file.
  2. JS can interact with DOM elements.
  3. DOM is created before the JS is executed.
  4. DOM is created after the JS is executed.
  5. HTML and DOM are identical.
MAD1 End Term · 10 May 2026 · open the full paper
Practice 23MCQ4 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 24MCQ4 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 25MCQ5 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 26MCQ5 marks
Consider the following HTML/JavaScript code. question figure The above code allows courses to be added dynamically to the element when the user clicks the “Add” Button. What is the most suitable given below?
Text of the picture (copyable)
File name: courses.html

```html
<!DOCTYPE html>
<html lang="en">
<body>
    <label>Enter course :</label>
    <input type="text" id="txt_course">
    <button onclick="add_item()">Add</button><br>
    Courses:<br>
    <ul id="courses">
        <!-- Empty courses-->
    </ul>
    <script>
        function add_item(){
            course=document.getElementById("txt_course").value;
            document.getElementById("txt_course").value="";
            // Missing JS Code snippet
        }
    </script>
</body>
</html>
```

Expected output:

Enter course : [text input field] [Add button]
Courses:
* Java
* PDSA
```html
<ul>
```
```javascript
//Missing JS Code snippet
```
  1. question figure
    text
    ```javascript
    courses=document.getElementById("txt_course");
    courses.innerHTML=courses.innerHTML+"<li>"+course+"</li>";
    ```
  2. question figure
    text
    ```javascript
    courses=document.getElementById("courses");
    courses.innerHTML=courses.innerHTML+"<li>"+course+"</li>";
    ```
  3. question figure
    text
    ```javascript
    courses.innerHTML=courses.innerHTML + "<li>"+course+"</li>";
    ```
  4. question figure
    text
    ```javascript
    courses.innerHTML = "<li>"+course+"</li>";
    ```
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 27MCQ3 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 28MCQ3 marks
Consider the following HTML/CSS code. question figure What will be the output when the above HTML file is rendered?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<head>
<style>
    p { color: blue; }
    .text { color: green; }
    #para { color: red; }
</style>
</head>
<body>
<p id="para" class="text" style="color: black;">
    IITM BS Degree Program
</p>
</body>
</html>
```
  1. text
    IITM BS Degree Program
  2. text
    IITM BS Degree Program
  3. text
    IITM BS Degree Program
  4. text
    IITM BS Degree Program
MAD1 Quiz 2 · 12 Apr 2026 · open the full paper
Practice 29MSQ2 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 30MSQ2 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 31MCQ4 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 32MCQ4 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 33MSQ5 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 2 · 12 Apr 2026 · open the full paper
Practice 34MCQ3 marks
Comprehension passage for this question
Consider the following SQLAlchemy class models. question figure Based on the above data, answer the given subquestions.
What will be the output if the following commands are executed in the python shell. question figure
Text of the picture (copyable)
```python
>>> u1 = User(uname = "Jane", pwd = "1234")
>>> p1 = Profile(name = "Analyst", email = "zoozle.com", user_id = u1.id)
>>> db.session.add_all([u1,p1])
>>> db.session.commit()
>>> user1 = User.query.filter_by(uname="Jane").first()
>>> user1.profile
```
  1. text
    <User 1>
  2. text
    ```
    [<Profile 1>]
    ```
  3. text
    ```html
    <Profile 1>
    ```
  4. text
    ```
    'Analyst'
    ```
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 35MCQ4 marks
Consider the HTML code below. question figure Which of the following will be the rendered output?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<head>
<style>
p {
  background-color: yellow;
  display:inline-block;
}

div p {
  background-color: lightblue;
}

.highlight {
  background-color: pink;
}

#special {
  background-color: orange;
}
</style>
</head>
<body>
<div>
  <p class="highlight">Paragraph One</p>
  <p class="highlight" id="special">Paragraph Two</p>
  <p>Paragraph Three</p>
</div>
</body>
</html>
```
  1. question figure
    text
    Paragraph One
    Paragraph Two
    Paragraph Three
  2. question figure
    text
    Paragraph One
    Paragraph Two
    Paragraph Three
  3. question figure
    text
    Paragraph One Paragraph Two Paragraph Three
  4. text
    Paragraph One Paragraph Two Paragraph Three
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 36MCQ3 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 37MCQ3 marks
Consider the following Jinja2 template: question figure What will be the output in the terminal?
Text of the picture (copyable)
```python
from jinja2 import Template

temp = """
{% set numbers = [5, 2, 8, 1, 9] %}
{% for num in numbers|sort -%}
<p>{{ num }}</p>
{%- endfor %}
"""

made_temp = Template(temp)
result = made_temp.render()
print(result)
```
  1. text
    ```html
    <p>5</p><p>2</p><p>8</p><p>1</p><p>9</p>
    ```
  2. text
    ```html
    <p>1</p><p>2</p><p>5</p><p>8</p><p>9</p>
    ```
  3. text
    ```html
    <p>9</p><p>8</p><p>5</p><p>2</p><p>1</p>
    ```
  4. text
    ```html
    <p>12589</p>
    ```
  5. text
    Template will throw an error
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 38MCQ3 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 39MSQ2 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 40MSQ5 marksselect all that apply
Consider the following users list. question figure
Text of the picture (copyable)
```python
users = [[{ "id":1, "name": "user_1", "role": "manager"},
          { "id":2, "name": "user_2", "role": "manager"},
          { "id":3, "name": "user_3", "role": "manager"}]]
```
An ordered HTML list is to be created for users where every list item should have a clickable "name" attribute redirecting to the endpoint "/show_users/<id>" where "id" is the "id" attribute of the same user dictionary. Which of the following is the correct way of doing it with jinja and HTML?
  1. question figure
    text
    ```html
    <ol>
    {% for user in users %}
        <li><a href="/show_users/{{user.id}}">{{user.name}}</a></li>
    {% endfor %}
    </ol>
    ```
  2. question figure
    text
    ```html
    <ol>
    {% for user in users %}
        <li><a href="/show_users/{{user['id']}}">{{user['name']}}</a></li>
    {% endfor %}
    </ol>
    ```
  3. question figure
    text
    ```html
    <ol>
        <li><a href="/show_users/{{users[0].id}}">{{users[0].name}}</a></li>
        <li><a href="/show_users/{{users[1].id}}">{{users[1].name}}</a></li>
        <li><a href="/show_users/{{users[2].id}}">{{users[2].name}}</a></li>
    </ol>
    ```
  4. question figure
    text
    ```html
    <ol>
    {% for user in users %}
        <li><a href="/show_users/{{user.name[-1]}}">{{user.name}}</a></li>
    {% endfor %}
    </ol>
    ```
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 41MSQ3 marksselect all that apply
Consider the following CSS code: question figure Which of the following statements are TRUE regarding the element's dimensions and spacing?
Text of the picture (copyable)
```css
#container {
  width: 200px;
  padding: 10px;
  border: 2px solid black;
  margin: 15px;
}
```
  1. The total width including padding and border is 224px
  2. The margin affects the content box width
  3. The padding adds internal spacing inside the element
  4. The border contributes to the total width in the standard box model
MAD1 Quiz 1 · 15 Mar 2026 · open the full paper
Practice 42MSQ3 marksselect all that apply
Which statements about CSS display properties are CORRECT?
  1. display: block elements always start on a new line and take full width
  2. display: inline elements can be manipulated with height and width properties
  3. display: inline-block elements can be placed inline and be manipulated with height and width properties
  4. display: inline elements can’t be manipulated with height and width properties
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 43MCQ4 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 44MCQ3 marks
Consider the following SQL create statement. question figure Which of the following flask_sqlalchemy models will create exactly the same table as created by the above SQL command?
Text of the picture (copyable)
```sql
CREATE TABLE employee (
    emp_id INTEGER NOT NULL,
    emp_code VARCHAR() NOT NULL,
    name VARCHAR(),
    salary INTEGER NOT NULL,
    join_date DATE NOT NULL,
    PRIMARY KEY (emp_id),
    UNIQUE (emp_code),
    UNIQUE (name)
)
```
  1. question figure
    text
    ```python
    class Employee(db.Model):
        emp_id = db.Column(db.Integer(), unique=True)
        emp_code = db.Column(db.String(), primary_key=True)
        name = db.Column(db.String(), unique=False)
        salary = db.Column(db.Integer())
        join_date = db.Column(db.Date())
    ```
  2. question figure
    text
    ```python
    class Employee(db.Model):
        emp_id = db.Column(db.Integer(), primary_key=True)
        emp_code = db.Column(db.String(), nullable=False, unique=True)
        name = db.Column(db.String(), unique=True)
        salary = db.Column(db.Integer(), nullable=False)
        join_date = db.Column(db.Date(), nullable=False)
    ```
  3. question figure
    text
    ```python
    class Employee(db.Model):
        emp_id = db.Column(db.Integer(), primary_key=True)
        emp_code = db.Column(db.String(), unique=True)
        name = db.Column(db.String(), unique=True, nullable=False)
        salary = db.Column(db.Integer())
        join_date = db.Column(db.Date())
    ```
  4. question figure
    text
    ```python
    class Employee(db.Model):
        emp_id = db.Column(db.Integer(), nullable=False)
        emp_code = db.Column(db.String(), unique=True)
        name = db.Column(db.String())
        salary = db.Column(db.Integer(), nullable=False)
        join_date = db.Column(db.Date(), nullable=False)
    ```
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 45MCQ4 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 46MSQ3 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 47MCQ3 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 48MCQ3 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 49MCQ2 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 50MCQ2 marks
Which of the following is the correct way to add a click event listener to a button with id="myBtn" in JavaScript?
  1. question figure
    text
    ```javascript
    document.getElementById("myBtn").onclick = function() {alert("Clicked!");
    };
    ```
  2. question figure
    text
    ```javascript
    document.getElementById("myBtn").addEventListener("click", function() {
        alert("Clicked!");
    });
    ```
  3. question figure
    text
    ```html
    <button onclick="alert('Clicked!')">Click Me</button>
    ```
  4. All of these
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 51MCQ3 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 52MCQ3 marks
question figure
Text of the picture (copyable)
You want to change the text of a `<p>` element with `id="msg"` to "Welcome to JavaScript!" when a button is clicked. Which code snippet correctly does this?

```html
<p id="msg">Old Message</p>
<button id="btn">Change</button>
<script>
    // Code goes here
</script>
```
  1. question figure
    text
    ```javascript
    document.getElementById("btn").onclick = function() {
        document.getElementById("msg").innerHTML = "Welcome to JavaScript!";
    };
    ```
  2. question figure
    text
    ```javascript
    document.getElementById("btn").addEventListener("click", function() {
        msg.text = "Welcome to JavaScript!";
    });
    ```
  3. question figure
    text
    ```javascript
    document.querySelector("#btn").addEventListener("click", function() {
        document.querySelector("#msg").innerText = "Welcome to JavaScript!";
    });
    ```
  4. Both andquestion figure
    text
    ```javascript
    document.getElementById("btn").onclick = function() {
        document.getElementById("msg").innerHTML = "Welcome to JavaScript!";
    };
    ```
MAD1 End Term · 21 Dec 2025 · open the full paper
Practice 53MCQ2 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 54MSQ5 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 55MSQ3 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 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 56MCQ2 marks
Which of the following is the correct syntax to display the total number of courses in a Jinja2 template?
  1. question figure
    text
    ```
    {{ courses | len }}
    ```
  2. question figure
    text
    ```jinja
    {{ courses | length }}
    ```
  3. question figure
    text
    ```html
    {{ len(courses) }}
    ```
  4. question figure
    text
    None of these
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 57MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following statements and select the correct option.

Statement 1: The `<span>` elements will start on new lines, while the `<div>` elements will appear inline with surrounding content.

Statement 2: The `<p>` and `<div>` elements will each start on new lines and take up the full width of their container, while `<span>`, `<strong>`, and `<em>` will flow inline with surrounding content.
  1. Statement 1 is correct, but statement 2 is incorrect.
  2. Statement 2 is correct, but statement 1 is incorrect.
  3. Both statements 1 and 2 are correct
  4. Both statements 1 and 2 are incorrect
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 58MCQ3 marks
question figure
Text of the picture (copyable)
Match the following web development concepts with their correct descriptions:

| Column A | Column B |
|---|---|
| 1. PyHTML | A. Lightweight engine in Python for embedding variables inside strings using `$variable` style |
| 2. Jinja2 | B. A Python library to build HTML structures programmatically using Python functions |
| 3. Template Rendering | C. The process of generating dynamic HTML by combining templates with data |
| 4. String Template Rendering | D. Templating engine used by Flask that supports control structures, filters, and inheritance |
  1. 1 → B, 2 → C, 3 → D, 4 → A
  2. 1 → A, 2 → B, 3 → C, 4 → D
  3. 1 → B, 2 → D, 3 → C, 4 → A
  4. 1 → C, 2 → D, 3 → A, 4 → B
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 59MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following HTML and CSS code:

```html
<html>
  <head>
    <style>
      div {
        width: 0px;
        margin: 0px;
      }
      .container {
        width: 200px;
        padding: 15px;
        border: 5px solid black;
      }
      #box {
        margin: 10px;
      }
    </style>
  </head>
  <body>
    <div class="container" id="box">Hello World</div>
  </body>
</html>
```

What is the **total width (approximately)** of the `div` with `class="container"` and `id="box"`, including **content, padding, and border** but excluding margin?
  1. 200 px
  2. 230 px
  3. 240 px
  4. 250 px
MAD1 Quiz 1 · 26 Oct 2025 · open the full paper
Practice 60MCQ4.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