MAD Study Hub

Home / Past papers / MAD1 Quiz 1 / this paper

Modern Application Development I 15 Mar 26 - 15 Mar 2026

MAD1 Quiz 116 questions50 marks9 MCQ · 7 MSQ
Elapsed 00:00
Q1MCQ4 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
Q2MCQ4 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
Q3MCQ5 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
Q4MCQ3 marks
Consider the following code: app.py question figure You are running a Flask web application locally using the command: python app.py. On which URL will the application be accessible in the browser?
Text of the picture (copyable)
```python
from flask import Flask
app = Flask(__name__)

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

if __name__ == "__main__":
    app.run(port=0007)
```
  1. https://127.0.0.1:5000/
  2. http://localhost:0007/
  3. http://0.0.0.0:0007/
  4. None of these
Q5MCQ3 marks
Consider the following Jinja2 template code: question figure What will be the output when the code is executed?
Text of the picture (copyable)
```python
from jinja2 import Template

temp = """
{% for num in seq | reject("even") -%}
{{ num + 2 }}
{%- endfor %}
"""

seq = [10, 3, 9, 8, 15]
output = Template(temp)
print(output.render(seq=seq))
```
  1. 10511817
  2. 125111017
  3. 3915
  4. 51117
Q6MCQ3 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
Q7MCQ3 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
Q8MCQ3 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
Q9MCQ2 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>
    ```
Q10MSQ2 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.
Q11MSQ2 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.
Q12MSQ2 marksselect all that apply
Which of the following are True about sys.argv in Python?
  1. sys.argv is a list containing command-line arguments.
  2. sys.argv[0] stores the Python script name.
  3. sys.argv elements are always interpreted as integers.
  4. sys.argv elements are always interpreted as strings.
Q13MSQ5 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>
    ```
Q14MSQ3 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
Q15MSQ3 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
Q16MSQ3 marksselect all that apply
Consider the following code. question figure Which substitution methods will work WITHOUT raising KeyError ?
Text of the picture (copyable)
```python
from string import Template
template = Template("Hello $name, you have $count messages")
===substitution method code===
print(out)
```
  1. out = template.substitute({"name": "Alice"})
  2. out = template.safe_substitute({"name": "Alice"})
  3. out = template.substitute({"name": "Alice", "count": 5})
  4. out = template.safe_substitute({"name": "Alice", "count": 5})

Answer key

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

Concepts this paper tests

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

Here's a summary of the core topics, concepts, principles, and equations essential for the exam, followed by a knowledge graph.


Summary of Core Topics and Concepts

The questions cover a broad range of topics within Modern Application Development, touching upon foundational Software Engineering principles, specific Python and Web Framework knowledge, Web Technologies (HTML, CSS), and basic Mathematical/Physics calculations.

I. Software Engineering & Web Development Fundamentals

  1. Python Programming Essentials:

    • Data Structures: Understanding and manipulating Python lists and dictionaries (accessing elements using dot notation or bracket notation).
    • Control Flow: if-elif-else statements for conditional logic.
    • Error Handling: try-except blocks for graceful management of potential runtime errors (e.g., during type conversion).
    • String Manipulation: F-strings for dynamic string formatting.
    • Command-Line Arguments (sys.argv):

      • sys.argv is a list holding command-line arguments.
      • sys.argv[0] contains the name of the script being executed.
      • All elements in sys.argv are strings by default and require explicit type conversion if needed.
    • String Templating (string.Template):

      • Template class for defining strings with placeholder variables (e.g., $variable).
      • substitute() method: Performs substitution, raises KeyError if a placeholder is not provided.
      • safe_substitute() method: Performs substitution, does not raise KeyError for missing placeholders; leaves them unchanged.
  1. Web Technologies (Frontend - HTML & CSS):

    • HTML Structure and Semantics:

      • Basic document structure (<!DOCTYPE html>, <html>, <head>, <body>).
      • Common elements: Paragraphs (<p>), divisions (<div>), hyperlinks (<a>), ordered lists (<ol>), list items (<li>).
      • Attributes: class, id, href. HTML attribute names are generally case-insensitive (though lowercase is best practice).
    • CSS Styling and Layout:

      • Selectors: Element (p), Class (.highlight), ID (#special), and Descendant selectors (div p).
      • Specificity: Rules are applied based on selector specificity (ID > Class > Element). Inline styles override internal/external styles.
      • Core Properties: background-color, width, padding, border, margin.
      • display Property: Controls how an element interacts with the document flow.

        • display: block: Elements start on a new line and take up the full available width. height and width properties are effective.
        • display: inline: Elements flow on the same line. height and width properties generally do not apply.
        • display: inline-block: Elements flow on the same line but can be manipulated with height and width properties, and respect vertical padding/margin.
      • CSS Box Model (Standard Model):

        • An element's total space is defined by its content, padding, border, and margin.
        • width and height properties, by default, refer to the content box.
        • padding adds internal spacing between the content and the border.
        • border is drawn around the padding.
        • margin adds external spacing around the element, separating it from other elements; it does not contribute to the element's total rendered width or height but affects its position relative to other elements.
        • Equation for Total Element Width: Total Width = content_width + 2 * padding_left + 2 * padding_right + 2 * border_left + 2 * border_right
      • Best Practices: External CSS is generally preferred over inline CSS for large-scale projects due to better organization and maintainability.
    • Character Encoding:

      • UTF-8: A variable-length encoding standard that can represent all Unicode characters. It is backward-compatible with ASCII.
      • UTF-32: A fixed-length encoding standard where each character occupies 4 bytes. It can also represent all Unicode characters.
  1. Web Backend Development (Flask & Jinja2):

    • Flask Framework:

      • Routing: Defining URL endpoints using @app.route().
      • Variable Rules: Capturing parts of the URL as variables (/<string:username>, /<int:post_id>).
      • Type Converters: Flask automatically converts URL variables based on specified types (string, int). Mismatching types (e.g., non-integer for <int>) will result in a 404 Not Found error.
      • Request Handling: Accessing URL query parameters (e.g., ?a=3&b=5) using request.args.get(). Understanding how to provide default values for missing parameters.
      • Server Configuration: Running the Flask application using app.run(). Specifying the listening port (e.g., port=0007). Default port is 5000. Understanding localhost (127.0.0.1) for local access and 0.0.0.0 for network-wide access.
      • Template Rendering: Using render_template() to send Python variables and data structures to Jinja2 templates for dynamic HTML generation.
    • Jinja2 Templating Engine:

      • Syntax: {% ... %} for control statements (loops, conditionals, variable assignments), {{ ... }} for outputting expressions/variables.
      • Control Structures: for loops to iterate over lists or dictionaries. if-elif-else statements for conditional content.
      • Filters: Applying filters like |reject("even") (to remove even numbers) or |sort (to sort a list).
      • Variable Assignment: {% set variable = value %} to define variables within the template.
      • Data Access: Accessing dictionary values using dot notation (user.id) or bracket notation (user['id'], user['name']).
      • Whitespace Control: Using -%} (to remove trailing whitespace) and {%- (to remove leading whitespace) within template tags to prevent unwanted newlines or spaces in the rendered output.
  1. Web Application Concepts and Architecture:

    • Components: A typical web application consists of a frontend (client-side), a backend (server-side), and a database.
    • Interaction: Web applications interact with backend services primarily through APIs (Application Programming Interfaces).
    • Execution Environment: Web applications run entirely in the client's browser; they do not require installation on the user's computer. They require a server to provide the frontend code and handle backend logic/data.
  1. Networking and Debugging Tools:

    • curl Command: A command-line tool for making HTTP requests.
    • Debugging Flags:

      • -v (verbose): Provides detailed information about the request and response, including headers.
      • -i (include): Includes HTTP response headers in the output.

II. Mathematics / Physics (Applied Calculations)

  1. Basic Kinematics:

    • Principle: The relationship between distance, speed, and time.
    • Equation: Time = Distance / Speed
    • Equation: Distance = Speed × Time
  1. Data Transfer Rate:

    • Principle: The amount of data transferred is a product of bandwidth and time.
    • Equation: Data Transferred = Bandwidth × Time
  1. Unit Conversions:

    • Speed: Converting kilometers per hour (kmph) to other units (e.g., km/second or m/second).
    • Data Units: Converting Megabits (Mbps) to Megabytes (MBps).

      • Conversion Factor: 1 Byte = 8 bits. Therefore, 1 Megabyte (MB) = 8 Megabits (Mb).