MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M DIPLOMA AN EXAM QDD4 31 Aug - 31 Aug 2025

MAD1 End Term32 questions100 marks25 MCQ · 7 MSQDiploma / afternoon / QDD4
Elapsed 00:00
Q1MCQ2 marks
question figure
Text of the picture (copyable)
You executed the following:

```python
student = Student.query.filter_by(id=2).first()
student.name = "Riya"
db.session.add(student)
print(student.name)
```

What will this print?
  1. Riya
  2. Name stored in database
  3. None
  4. Error
Q2MCQ2 marks
What does SQLAlchemy's lazy='dynamic' do?
  1. Loads extra content of all the tables
  2. Returns a query object that can be filtered
  3. Loads all related records immediately
  4. Forces join queries at once
Q3MCQ2 marks
Why is using the GET method for sensitive data discouraged?
  1. GET encrypts the URL
  2. Data becomes part of browser history and URL
  3. It uses a separate request header
  4. Flask doesn’t support GET by default
Q4MCQ2 marks
question figure
Text of the picture (copyable)
You define two routes in your Flask app as:

```python
@app.route('/home')
def home():
    return "Home No Slash"

@app.route('/about/')
def about():
    return "About With Slash"
```

A user visits /about (without the trailing slash). What will Flask do?
  1. question figure
    text
    Responds with 404 Not Found
  2. question figure
    text
    Automatically redirects to /about/
  3. question figure
    text
    Responds with "About With Slash"
  4. question figure
    text
    Responds with "Home No Slash"
Q5MCQ2 marks
A login form doesn't show any message when users enter wrong credentials. Which Nielsen heuristic is violated?
  1. Aesthetic and minimalist design
  2. Visibility of system status
  3. Error prevention
  4. Recognition rather than recall
Q6MSQ2 marksselect all that apply
Which of the following are handled by the browser and not the Flask server?
  1. Parsing HTML
  2. Auto-filling saved form data
  3. URL routing
  4. JavaScript execution
Q7MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following git branches for a remote repository.

```
feature1
* feature2
main
```

Choose the correct git command sequence to merge *feature1* and *feature2* into the *main* branch.
  1. question figure
    text
    ```
    git merge feature1
    git merge feature2
    git merge main
    ```
  2. question figure
    text
    ```
    git checkout feature1
    git merge feature2
    git merge main
    ```
  3. question figure
    text
    ```
    git checkout main
    git merge feature1
    git merge feature2
    ```
  4. question figure
    text
    ```
    git merge main
    git merge feature1
    git merge feature3
    ```
Q8MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML code.

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Home page</title>
    <style>
        /* Missing CSS code */
    </style>
</head>
<body>
    <div id="mybox">
        IITM Online Degree
    </div>
</body>
</html>
```

Which of the following /* Missing CSS code */ renders the below output?

A rectangular box with an orange background and a thin dark border, containing the text "IITM Online Degree" in a dark, bold font.
  1. question figure
    text
    ```css
    #mybox{
        width: 140px;
        height: 40px;
        background-color: orange;
        stroke: black;
    }
    ```
  2. question figure
    text
    ```css
    #mybox{
        width: 140px;
        height: 40px;
        background-color: orange;
        border-colour: 1px solid black;
    }
    ```
  3. question figure
    text
    ```css
    #mybox{
        width: 140px;
        height: 40px;
        background-color: orange;
        foreground-color: black;
    }
    ```
  4. question figure
    text
    ```css
    #mybox{
        width: 140px;
        height: 40px;
        background-color: orange;
        border:1px solid black;
    }
    ```
Q9MCQ3 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]
    ```
Q10MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Flask code.

```python
from flask import Flask
import sys

app = Flask(__name__)

# Read multiplier from command-line
MULTIPLIER = int(sys.argv[1]) if len(sys.argv) > 1 else 1

@app.route('/multiply/<int:number>')
def multiply(number):
    return f"Result: {number % MULTIPLIER}"

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

What will be the output when you run the following code in the terminal
python app.py 5 and then access in the browser with the following link
http://localhost:5000/multiply/4 ?
  1. Result: 20
  2. Result: 1
  3. Result: 5
  4. Result: 4
Q11MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code

File name: main_test.py
```python
import pytest

class TestGroup:

    def do_something(self, x, y):
        return x % y

    def test_one(self):
        assert self.do_something(10, 5) == 0, " Is 5 factor of 10? "

    def test_two(self):
        assert self.do_something(32, 5) == 0, " Is 5 factor of 32 "
```
What will be the output of running the above python script using command line "pytest -v main_test.py"?
  1. question figure
    text
    ```
    ==================== short test summary info ====================
    FAILED test6.py::TestGroup::test_two - AssertionError: Is 5 factor of
    32
    ========== 1 failed, 1 passed in 0.12s ==========================
    ```
  2. question figure
    text
    ```text
    ==================== short test summary info ====================
    test6.py::TestGroup::test_one PASSED                  [ 50%]
    test6.py::TestGroup::test_two PASSED                 [100%]
    
    ==================== 2 passed in 0.02s====================
    ```
  3. question figure
    text
    ```text
    ==================== short test summary info ====================
    test6.py::TestGroup::test_one FAILED           [ 50%]
    test6.py::TestGroup::test_two FAILED          [100%]
    
    ==================== 2 failed in 0.02s====================
    ```
  4. question figure
    text
    ```
    ==================== short test summary info ====================
    FAILED test6.py::TestGroup::test_two - AssertionError: Is 5 factor of
    10
    FAILED test6.py::TestGroup::test_two - AssertionError: Is 5 factor of
    32
    ==================== 2 failed in 0.12s ====================
    ```
Q12MCQ3 marks
question figure
Text of the picture (copyable)
You created the following templates:

**base.html**

```html
<html>
<body>
    {% block content %}{% endblock %}
</body>
</html>
```

**home.html**

```html
{% extends "base.html" %}
<h1>Welcome!</h1>
```

But when rendered, "Welcome!" doesn't appear. Why?
  1. question figure
    text
    extends is incorrectly used
  2. question figure
    text
    base.html has syntax errors
  3. question figure
    text
    Flask template folder is missing
  4. question figure
    text
    ```html
    <h1> should be inside {% block content %}
    ```
Q13MCQ3 marks
A user downloads a 10 MB file from a server with 5 Mbps speed. How long does it approximately take?
  1. 2 seconds
  2. 10 seconds
  3. 16 seconds
  4. 1.6 seconds
Q14MCQ3 marks
question figure
Text of the picture (copyable)
Suppose you have these models in your Flask-SQLAlchemy app:

```python
class Author(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    books = db.relationship('Book', backref='author', cascade="all, delete")

class Book(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(80))
    author_id = db.Column(db.Integer, db.ForeignKey('author.id'))
```

If you delete an Author instance from the database, what happens to their related Book instances?
  1. question figure
    text
    The books remain in the database, with author_id set to NULL
  2. question figure
    text
    The books remain, but are marked as "inactive"
  3. question figure
    text
    The books are also deleted from the database
  4. question figure
    text
    An error is raised and the deletion is prevented
Q15MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML code snippet (without any CSS styling).

```html
<div>
    <p>This is paragraph 1</p>
    <span>Span element 1</span>
    <span>Span element 2</span>
    <p>This is paragraph 2</p>
    <a href="#">Link 1</a>
    <a href="#">Link 2</a>
    <div>Nested div content</div>
    <strong>Bold text</strong>
    <em>Italic text</em>
</div>
```

Which of the following statements correctly describes how the elements will be displayed by default in a browser?
  1. question figure
    text
    All elements will appear on the same line since they are nested within a single
    `<div>`
  2. question figure
    text
    <p>, <div>, and both <a> elements will start on new lines, while <span>, <strong>, and <em> will flow inline with adjacent content
  3. question figure
    text
    Only `<div>` elements will start on new lines, all other elements will display inline
  4. question figure
    text
    `<p>` and `<div>` elements will start on new lines, while `<span>`, `<a>`, `<strong>`, and `<em>` elements will flow inline with adjacent inline elements
Q16MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code.

File name: main.py
```python
def funA(func):
    def inner_wrapper():
        print("Wrapper function of funA")
        res1 = func()
        res2 = func()
        return res1, res2
    return inner_wrapper

@funA
def funB():
    return "I am from funB"

print(funB())
```

What will be the output, when running the above code using the command "python main.py"?
  1. question figure
    text
    ```
    ('I am from funB', 'I am from funB')
    Wrapper function of funA
    ```
  2. question figure
    text
    Wrapper function of funA
    I am from funB
    I am from funB
  3. question figure
    text
    ```
    Wrapper function of funA
    ('I am from funB', 'I am from funB')
    ```
  4. question figure
    text
    ```text
    I am from funB
    I am from funB
    Wrapper function of funA
    ```
Q17MCQ3 marks
question figure
Text of the picture (copyable)
Consider the table and match each type of software testing with its correct focus area.

| Test Type | Focus Area |
|---|---|
| 1. Unit Testing | a. Simulated end-user browser-based interaction |
| 2. Integration Testing | b. Whole app in full environment including server |
| 3. System Testing | c. Real-world verification by actual users before release |
| 4. System Testing Automation | d. Multiple components/modules working together |
| 5. User Acceptance Testing | e. Smallest logical units (functions/methods) |
  1. 1-a, 2- c, 3-b, 4-d, 5-e
  2. 1-b, 2- c, 3-a, 4-e, 5-d
  3. 1-e, 2- d, 3-c, 4-a, 5-b
  4. 1-e, 2- d, 3-b, 4-a, 5-c
Q18MCQ4.5 marks
question figure
Text of the picture (copyable)
You are working on a team project hosted on GitHub. After making changes to your local files, you run the following commands in this exact order:

```shell
git status
git add .
git commit -m "Fixed header bug"
git push
git pull
```

Assuming your teammate pushed a new change **just before** you did `git push`, what is the most likely outcome?
  1. question figure
    text
    Your commit will be rejected because the remote branch is ahead of your local branch.
  2. question figure
    text
    The `git pull` should have been run **before** `git push` to avoid possible conflicts.
  3. question figure
    text
    The `git push` will automatically merge your changes with the remote and succeed.
  4. question figure
    text
    The `git status` will show the conflict before `git push` is run.
Q19MCQ4.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
Q20MCQ4.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
    ```
Q21MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet:

**python: app.py**

```python
from string import Template
from jinja2 import Template as JinjaTemplate
import sys

mode = sys.argv[1]
data = {"user": "Bob", "language": "JavaScript", "project": "web app",
        "status": "completed"}

template_str = "Hello ${user}! Your {{project}} written in {{language}} is ${status}."

if mode == "hybrid":
    str_template = Template(template_str)
    intermediate = str_template.substitute(data)
    jinja_template = JinjaTemplate(intermediate)
    result = jinja_template.render(data)
    print(result)
else:
    jinja_template = JinjaTemplate(template_str)
    result = jinja_template.render(data)
    print(result)
```

What will be printed on the terminal for the command: `python app.py hybrid` ?
  1. question figure
    text
    ```
    Hello ${user}! Your {{project}} written in {{language}} is
    ${status}.
    ```
  2. question figure
    text
    ```
    Hello Bob! Your {{project}} written in {{language}} is completed.
    ```
  3. question figure
    text
    Hello Bob! Your web app written in JavaScript is completed.
  4. question figure
    text
    ```
    Hello ${user}! Your web app written in JavaScript is ${status}.
    ```
Q22MSQ3 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
    ```
Q23MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Which of these are true about unit tests in Flask using pytest?
  1. question figure
    text
    Tests must start with test_ prefix
  2. question figure
    text
    You must import `FlaskClient` from `flask.testing`
  3. question figure
    text
    You cannot test routes using `client.get()`
  4. question figure
    text
    Fixtures help simulate isolated environments
Q24MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Examine the following Python test file:

Filename: math_tests.py

```python
import pytest

def multiply(a, b):
    return a * b

def divide(a, b):
    if b == 0:
        raise ValueError("Cannot divide by zero")
    return a / b

@pytest.mark.unit
def test_multiply_positive():
    assert multiply(3, 4) == 12

@pytest.mark.integration
def test_divide_normal():
    assert divide(10, 2) == 5.0

@pytest.mark.slow
@pytest.mark.integration
def test_complex_calculation():
    result = divide(multiply(6, 7), 2)
    assert result == 21.0

@pytest.mark.unit
def test_multiply_negative():
    assert multiply(-2, 3) == -6
```

Consider the following pytest command output:

========= 1 passed, 3 deselected in 0.02s =========

Which of the following pytest commands would produce the output shown above?
  1. question figure
    text
    ```
    pytest math_tests.py -m unit
    ```
  2. question figure
    text
    ```
    pytest math_tests.py -m integration
    ```
  3. question figure
    text
    ```
    pytest math_tests.py -m "not sLow"
    ```
  4. question figure
    text
    ```
    pytest math_tests.py -m "slow and integration"
    ```
  5. question figure
    text
    None of these
Q25MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following HTML code.

**File name: home.html**

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Home page</title>
    <script>
        //Missing JS code
    </script>
</head>
<body>
    <form>
        Your name : <input type="text" id="txt1" value="Welcome to IITM Online BS Degree" size="35">
        <br>
        <input type="button" onclick="doSomething()" value="Click me!">
    </form>
</body>
</html>
```

Assume the user clicks the “**Click me!**” button on the below-rendered output.

Your name : [text input field with value "Welcome to IITM Online BS Degree"]
[button with text "Click me!"]

Which of the following //Missing JS code will change the text box font style into **bold**?
  1. question figure
    text
    ```javascript
    function doSomething(){
        txt1=document.getElementById("txt1");
        txt1.style="bold";
    }
    ```
  2. question figure
    text
    ```javascript
    function doSomething(){
        document.getElementById("txt1").style="bold";
    }
    ```
  3. question figure
    text
    ```javascript
    function doSomething(){
        txt1=document.getElementById("txt1");
        txt1.style.fontWeight="bold";
    }
    ```
  4. question figure
    text
    ```javascript
    function doSomething(){
        document.getElementById("txt1").style.fontWeight="bold";
    }
    ```
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q26MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
If the application is running locally
on http://127.0.0.1:5000, which
of the following statements are TRUE?
  1. question figure
    text
    URL http://127.0.0.1:5000/course?id=IT2002 will render:
    ```html
    <h2>Database Systems - Level: Beginner</h2>
    ```
  2. question figure
    text
    URL http://127.0.0.1:5000/course will render:
    ```html
    <h2> - Level: Beginner</h2>
    ```
  3. question figure
    text
    URL http://127.0.0.1:5000/course?id=IT2005&level=advanced will return HTTP
    404 error with message: "Not Found: Course does not exist"
  4. question figure
    text
    URL http://127.0.0.1:5000/search?q=data&min=2 will render:
    ```html
    <ul><li>Database Systems</li><li>Data Structures</li></ul>
    ```
  5. question figure
    text
    URL http://127.0.0.1:5000/search?q=web will return HTTP 422 error with
    message: "Unprocessable Entity: Query too short"
Q27MSQ3 marksselect all that apply
Analyze the following URLs and their expected behaviors. Which statement is CORRECT?
  1. question figure
    text
    http://127.0.0.1:5000/search?q= will return:
    ```html
    <p>No courses found</p>
    ```
  2. question figure
    text
    http://127.0.0.1:5000/search?q=system&min=10 will return:
    HTTP 422 error with message "Unprocessable Entity: Query too short"
  3. question figure
    text
    http://127.0.0.1:5000/search?q=DATA&min=4 will return:
    ```html
    <ul><li>Database Systems</li><li>Data Structures</li></ul>
    ```
  4. question figure
    text
    http://127.0.0.1:5000/search?q=python&min=0 will return:
    ```html
    <p>No courses found</p>
    ```
  5. question figure
    text
    http://127.0.0.1:5000/search?min=2 will return:
    HTTP 422 error with message "Unprocessable Entity: Query too short"
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q28MCQ4.5 marks
question figure
Text of the picture (copyable)
The given Flask-RESTful app is running
on http://127.0.0.1:5000. Which of
the following HTTP requests will result in
a runtime error due to method signature
mismatch?
  1. question figure
    text
    ```
    curl http://127.0.0.1:5000/students/123 -X PUT
    ```
  2. question figure
    text
    ```
    curl http://127.0.0.1:5000/students -X POST -d
    "name=Jay&age=20"
    ```
  3. question figure
    text
    ```
    curl http://127.0.0.1:5000/courses/CS101 -X POST
    ```
  4. question figure
    text
    ```
    curl http://127.0.0.1:5000/students -X DELETE
    ```
Q29MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTTP requests
to the same Flask-RESTful application.

What will be the response status code
for each request?

Request 1: `curl http://127.0.0.1:5000/students -X POST -d "name=Ashish"`

Request 2: `curl http://127.0.0.1:5000/courses/CS101/enroll/456 -X POST`

Request 3: `curl http://127.0.0.1:5000/students/789 -X DELETE`
  1. Request 1: 400, Request 2: 201, Request 3: 204
  2. Request 1: 201, Request 2: 201, Request 3: 204
  3. Request 1: 400, Request 2: 405, Request 3: 204
  4. Request 1: 201, Request 2: 405, Request 3: 200
Comprehension passage - the questions below it refer to this
question figure
Q30MCQ3 marks
question figure
Text of the picture (copyable)
What will be the output of visiting the URL

http://localhost:5000/score?name=Alex&marks=eighty ?
  1. Alex scored 0 and received grade F.
  2. Alex scored eighty and received grade F
  3. Error 500: Internal Server Error
  4. Invalid marks for Alex
Q31MCQ2 marks
question figure
Text of the picture (copyable)
What will be the output of visiting the URL

http://localhost:5000/score?marks=88 ?
  1. Guest scored 88 and received grade A
  2. Guest scored 0 and received grade F
  3. Guest scored 88 and received grade B
  4. Invalid marks for Guest
Q32MCQ2 marks
question figure
Text of the picture (copyable)
What is the output of visiting the URL

http://localhost:5000/score?name=Anya&marks=59.5 ?
  1. Anya scored 59.5 and received grade F
  2. Invalid marks for Anya
  3. Anya scored 0 and received grade F
  4. Anya scored 59 and received grade F

Answer key

  1. Q1 (MCQ, 2 marks): A
  2. Q2 (MCQ, 2 marks): B
  3. Q3 (MCQ, 2 marks): B
  4. Q4 (MCQ, 2 marks): B
  5. Q5 (MCQ, 2 marks): B
  6. Q6 (MSQ, 2 marks): A, B, D
  7. Q7 (MCQ, 3 marks): C
  8. Q8 (MCQ, 3 marks): D
  9. Q9 (MCQ, 3 marks): B
  10. Q10 (MCQ, 3 marks): D
  11. Q11 (MCQ, 3 marks): A
  12. Q12 (MCQ, 3 marks): D
  13. Q13 (MCQ, 3 marks): C
  14. Q14 (MCQ, 3 marks): C
  15. Q15 (MCQ, 3 marks): D
  16. Q16 (MCQ, 3 marks): C
  17. Q17 (MCQ, 3 marks): D
  18. Q18 (MCQ, 4.5 marks): B
  19. Q19 (MCQ, 4.5 marks): B
  20. Q20 (MCQ, 4.5 marks): C
  21. Q21 (MCQ, 4.5 marks): C
  22. Q22 (MSQ, 3 marks): A, C
  23. Q23 (MSQ, 3 marks): A, D
  24. Q24 (MSQ, 4.5 marks): C, D
  25. Q25 (MSQ, 4.5 marks): C, D
  26. Q26 (MSQ, 4.5 marks): A, C, D
  27. Q27 (MSQ, 3 marks): C, D, E
  28. Q28 (MCQ, 4.5 marks): C
  29. Q29 (MCQ, 3 marks): A
  30. Q30 (MCQ, 3 marks): D
  31. Q31 (MCQ, 2 marks): C
  32. Q32 (MCQ, 2 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.

Here’s a structured summary of the core topics, concepts, principles, and equations (where applicable) for the "Diploma Level: Modern Application Development I" exam, along with Mermaid knowledge graphs to visualize relationships.


Core Topics & Concepts Summary

1. Flask (Python Web Framework)

Key Concepts:

Key Code Snippets:

### Dynamic Route
@app.route('/user/<int:user_id>')
def get_user(user_id):
    return f"User ID: {user_id}"

### Query Parameters
@app.route('/search')
def search():
    query = request.args.get('q')
    return f"Searching for: {query}"

### Template Rendering
return render_template('page.html', title="Home")

### SQLAlchemy Relationship (Cascade Delete)
class Author(db.Model):
    books = db.relationship('Book', cascade="all, delete")

### Flask-RESTful Resource
class UserResource(Resource):
    def get(self, user_id):
        return {"user_id": user_id}

2. Git & Version Control

Key Concepts:

Key Commands:

### Merge feature branches into main
git checkout main
git merge feature1
git merge feature2

### Resolve conflicts after failed push
git pull
### Fix conflicts, then:
git add .
git commit -m "Resolved conflicts"
git push

3. HTML/CSS/JavaScript

Key Concepts:

Common Pitfalls:


4. HTTP & Web Concepts

Key Concepts:


5. Testing (Pytest)

Key Concepts:

Example:

@pytest.mark.unit
def test_addition():
    assert 1 + 1 == 2

### Run only unit tests
pytest -m unit

6. SQLAlchemy & Databases

Key Concepts:

Example:

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    posts = db.relationship('Post', cascade="all, delete")

### Delete user → deletes all their posts
user = User.query.get(1)
db.session.delete(user)
db.session.commit()

7. Frontend-Backend Interaction

Key Concepts:


8. Logging & Debugging

Key Concepts:


9. User Experience (UX) Heuristics

Nielsen’s Heuristics Violations:


10. RESTful APIs

Key Concepts:

Example:

class StudentResource(Resource):
    def get(self, student_id):
        return {"student_id": student_id}

api.add_resource(StudentResource, '/students/<int:student_id>')

2. Git Workflow

3. HTML/CSS/JS Relationship

4. Testing Pyramid

5. HTTP Methods & Status Codes


Key Equations (Mathematics/Performance)

  1. Bandwidth Calculation: \[ \text{Time (seconds)} = \frac{\text{File Size (MB)}}{\text{Bandwidth (MB/s)}} \]

    • Example: 10 MB at 5 Mbps (0.625 MB/s) → \( \frac{10}{0.625} = 16 \) seconds.
  1. Modulo Operation (from Flask examples): \[ a \% b = \text{Remainder of } a \div b \]

    • Example: 4 % 5 = 4.

Exam Tips

  1. Flask:

    • Remember trailing slash behavior (/about → /about/ redirect).
    • lazy='dynamic' returns a query object.
    • Template content must be inside {% block %}.
  1. Git:

    • Always git pull before git push to avoid conflicts.
    • Merge sequence: Checkout target branch first.
  1. HTML/CSS:

    • border: 1px solid black (not border-colour).
    • font-weight: bold (not style="bold").
  1. Testing:

    • Pytest requires test_ prefix in function filenames.
    • -m flag filters tests by markers.
  1. HTTP:

    • GET is unsafe for sensitive data (visible in URL).
    • 422 = Unprocessable Entity (validation error).