MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M DIPLOMA FN EXAM QDD1 13 Apr 2025 - 13 Apr 2025

MAD1 End Term32 questions100 marks26 MCQ · 6 MSQDiploma / forenoon / QDD1
Elapsed 00:00
Q1MCQ2 marks
question figure
Text of the picture (copyable)
In a Flask application, we have a base template (`base.html`) that includes a `{% block content %}` section. A child template (`home.html`) extends this base template and uses `{{ super() }}` inside `{% block content %}`.

What will be the effect of using `{{ super() }}` inside the block in the child template?
  1. question figure
    text
    It will result in an error because `super()` is not valid in Jinja2.
  2. question figure
    text
    It will completely replace the content of {% block content %} in the base template.
  3. question figure
    text
    It will include the content from the base template's {% block content %} along
    with the overridden content in the child template.
  4. question figure
    text
    It will ignore the base template's content and only render the child template's content.
Q2MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

```python
from jinja2 import Template

newlist = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig']

this_template = """
{% for item in data %}
    {% if item|length<6 %}
        {{ item }}
    {% endif %}
{% endfor %}
"""

out = Template(this_template)

print(out.render(data=newlist))
```

What will be the output on the terminal?
  1. question figure
    text
    ```
    appledatefig
    ```
  2. question figure
    text
    apple date fig
  3. question figure
    text
    banana cherry elderberry
  4. question figure
    text
    bananacherryelderberry
Q3MCQ2 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
    ```
Q4MCQ2 marks
question figure
Text of the picture (copyable)
Match the Column-A with the Column-B.

| | Column-A | | Column-B |
|---|---|---|---|
| 1 | GET | a | Defines the view/layout of the web app |
| 2 | SQLAlchemy | b | Defines the model/table of the web app |
| 3 | Template | c | Method of HTTP request |
| 4 | SQLite | d | Object Relational Mapping |
  1. 1-c, 2-a, 3-d, 4-b
  2. 1-d, 2-c, 3-a, 4-b
  3. 1-c, 2-d, 3-b, 4-a
  4. 1-c, 2-d, 3-a, 4-b
Q5MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following example:

```html
<form>
    <label for="search-input">Search for a word:</label>
    <input
        type="text"
        id="search-input"
        placeholder="Type a word to search"
        aria-describedby="search-help"
        required
    />
    <small id="search-help">Enter a word to find relevant results.</small>
    <button type="submit">Start Search</button>
</form>
```

Which of the following accessibility principles is followed in this example?
  1. Perceivable
  2. Operable
  3. Understandable
  4. Robust
Q6MCQ3 marks
question figure
Text of the picture (copyable)
A Flask application and its absolute path is given below.

C:\home\mad_1>

**app.py**

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

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

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

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

app.run(debug = True)
```

If the application is run locally on http://127.0.0.1:5000 using the command python app.py stable, what will be rendered by the browser for URL http://127.0.0.1:5000/home?
  1. question figure
    text
    static url path: C:\home\mad_1\static
    static folder: /static
  2. question figure
    text
    static url path: /static
    static folder: C:\home\mad_1\static
  3. question figure
    text
    static url path: /stable
    static folder: C:\home\mad_1\stable
  4. question figure
    text
    static url path: /stable
    static folder: C:\home\mad_1\static
Q7MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML code below.

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <style>
        body{text-align: center;}
        p{font-size: 30px;color: black;}
        .blue{color: red;}
        .red{color: green !important;}
        .green{color: blue;}
        #myId{color: grey;}
    </style>
</head>
<body>
    <div>
        <p class="blue">Text1</p>
        <p class="red" id="myId">Text2</p>
        <p class="green" id="myId">Text3</p>
        <p class="green">Text4</p>
    </div>
</body>
</html>
```

How will the browser render the above HTML file?
Match the rendered color for the text.

| 1. Text1 | a. green |
|---|---|
| 2. Text2 | b. blue |
| 3. Text3 | c. red |
| 4. Text4 | d. grey |
  1. 1- b, 2 - a, 3- d, 4 - c
  2. 1- c, 2 - d, 3- d, 4 - b
  3. 1- c, 2 - a, 3- d, 4 - b
  4. 1- a, 2 - c, 3- b, 4 - d
Q8MCQ3 marks
A Server S needs to retrieve data from two datacenters D1 and D2 located at 1500 kilometres and 3000 kilometres respectively. Server S and D1 are connected via medium M1 through which information can be transferred with the speed of 1.5×108 m/sec, and server S and D2 are connected via medium M2. If the server received data from both the data centres at the same time, what must be the speed of information transfer in medium M2(overheads should be ignored)? (Concept: Performance parameters of a network)
  1. question figure
    text
    1.5 x 10^8 m/sec
  2. question figure
    text
    2 × 10⁸ m/sec
  3. question figure
    text
    2.7 × 10⁸ m/sec
  4. question figure
    text
    3 × 10⁸ m/sec
Q9MCQ3 marks
question figure
Text of the picture (copyable)
Let L = { 'a', 'b', 'c', 'd', 'A', 'B', 'C', 'D', '^', '*', '#', '!', '$' } be a complete character set (i.e., only these characters can be used to represent text in the document). If a document that uses fixed encoding with optimal number of bits for all characters is created using the character set L and has a disk size of 3 Kilobytes, the number of characters in the documents would be _____. [Take 1 Byte = 8 bits, 1 KB = 1000 Bytes, 1 MB = 1000 Kilobytes and so on.]
  1. 3000
  2. 6000
  3. 9000
  4. 12000
Q10MCQ3 marks
question figure
Text of the picture (copyable)
A mobile server and a client initially 1000 km apart are moving towards each other
in a straight line with the speeds of 180 kmph and 70 kmph respectively. The network
bandwidth is set constant to 3 Mbps. Determine how much data (in Gigabytes) is used
by the client before the client and the server collide. [speed of light in vacuum: 3 x 10⁸
m/sec, 1 MB = 1000 KB and so on.]
  1. 64.8
  2. 18
  3. 5.4
  4. 22.5
Q11MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following flask app. Given that **test_request_context()** allows text
to be printed on the terminal, which of the following statements is correct?

```python
from flask import Flask, url_for

app = Flask(__name__)

@app.route('/hello')
def hello():
    return 'Hello World!'

@app.route('/user/<username>')
def user(username):
    return f'Welcome {username}!'

with app.test_request_context():
    #== print statement ==#
```
  1. question figure
    text
    If `print statement` is replaced by `print(url_for('user', username='John'))`, the output on the terminal will be `/user?username=John`
  2. question figure
    text
    If `print statement` is replaced by `print(url_for('user', username='John', id='101'))`, the output on the terminal will be
    `/user/John/101`
  3. question figure
    text
    If `print statement` is replaced by `print(url_for('hello', username='John'))`, the output on the terminal will be Hello World!
  4. question figure
    text
    If `#== print statement ==#` is replaced by `print(url_for('hello', username='John'))`,
    the output on the terminal will be `/hello?username=John`.
Q12MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

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

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

class MyApi(Resource):
    def get(self):
        return {"message":"Hello user!"}

    def put(self):
        return {"message":"Hello World!"}

api.add_resource(MyApi, '/api/get', '/api/put', '/api/post')

app.run()
```

If this application is running locally on http://127.0.0.1:5000, which of the following curl commands will throw an error?

1. `curl http://127.0.0.1:5000/api/get -X get`
2. `curl http://127.0.0.1:5000/api/put -X put`
3. `curl http://127.0.0.1:5000/api/post -X post`
4. `curl http://127.0.0.1:5000/api/get -X put`
5. `curl http://127.0.0.1:5000/api/put -X get`
6. `curl http://127.0.0.1:5000/api/post -X get`
  1. Only 3
  2. Only 3 and 4
  3. Only 5 and 6
  4. Only 3, 4, 5 and 6
Q13MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML code.

**File name: login.html**
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Login Page</title>
</head>
<body>
    <form action="/">
        <label for="uname">Username</label><br>
        <input type="text" name="uname" id="uname"><br>
        <label for="pwd">Password</label><br>
        <input type="password" name="pwd" id="pwd"><br>
        <input type="submit" value="Login">
    </form>
</body>
</html>
```

When the user clicks on the "Login" button the form data will be sent to the server using which HTTP method?
  1. GET
  2. POST
  3. PUT
  4. DELETE
Q14MCQ3 marks
question figure
Text of the picture (copyable)
Consider the code below in a file called test_students.py.

test_students.py
```python
import pytest

@pytest.fixture
def students():
    return {"names": ["ravi", "raj"], "ages": [12, 9]}

@pytest.mark.check
def test_name(students):
    assert "ravi" in students['names']

@pytest.mark.check
def test_age(students):
    assert students['ages'][0] > 9

def test_check(students):
    assert "raj" not in students['names']
```

What will be the output on the terminal on running the command "pytest -m check"? (assume that the tests ran in 0.03s and that the markers have been registered)
  1. question figure
    text
    ```
    ======== 2 passed, 1 deselected in 0.03s ========
    ```
  2. question figure
    text
    ```
    ======== 2 passed in 0.03s========
    ```
  3. question figure
    text
    ```text
    ======== 1 passed, 1 failed in 0.03s ========
    ```
  4. question figure
    text
    ```
    ========2 passed, 1 failed in 0.03s========
    ```
Q15MCQ3 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
    I am from funB
    I am from funB
    Wrapper **function** of funA
Q16MCQ3 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 main_test.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 ========================
    main_test.py::TestGroup::test_one PASSED                               [ 50%]
    main_test.py::TestGroup::test_two PASSED                              [100%]
    
    ====================== 2 passed in 0.02s================================
    ```
  3. question figure
    text
    ```text
    ==================== short test summary info ====================
    main_test.py::TestGroup::test_one FAILED                  [ 50%]
    main_test.py::TestGroup::test_two FAILED                 [100%]
    
    ==================== 2 failed in 0.02s====================
    ```
  4. question figure
    text
    ```text
    ========== short test summary info ==========
    FAILED main_test.py::TestGroup::test_two - AssertionError: Is 5
    factor of 10
    FAILED main_test.py::TestGroup::test_two - AssertionError: Is 5
    factor of 32
    ========== 2 failed in 0.12s ==========
    ```
Q17MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following Jinja2 templating code:

```python
from jinja2 import Template

template_str = """
{% set gifts = [
    {'name': 'Teddy Bear', 'price': 250, 'rating': 4.2},
    {'name': 'Coffee Mug', 'price': 150, 'rating': 4.5},
    {'name': 'Keychain', 'price': 100, 'rating': 3.9},
    {'name': 'Notebook', 'price': 180, 'rating': 4.7},
    {'name': 'Wall Clock', 'price': 300, 'rating': 4.0}
] %}

<ul>
{% for gift in gifts if gift.price < 200 and gift.rating > 4 %}
    <li>{{ gift.name }} - {{ gift.price }} - {{ gift.rating }}</li>
{% endfor %}
</ul>
"""

template = Template(template_str)
rendered_str = template.render()
print(rendered_str)
```

Will the above Jinja templating code return the correct output? If yes, what will be the result?
  1. question figure
    text
    The template will work correctly, and the output will be:
    
    ```html
    <ul>
      <li>Coffee Mug - 150 - 4.5</li>
      <li>Notebook - 180 - 4.7</li>
    </ul>
    ```
  2. question figure
    text
    The template will not work correctly because the **for** loop condition (if `gift.price < 200` and `gift.rating > 4`) is invalid in Jinja2 syntax. This will raise a `TemplateSyntaxError`.
  3. question figure
    text
    The template will work correctly, but the output will include all gifts, not filtering by price and rating, as the condition inside the for loop will be ignored.
  4. question figure
    text
    The template will work correctly, and the output will be:
    ```html
    <ul>
        <li>Teddy Bear - 250 - 4.2</li>
        <li>Wall Clock - 300 - 4.0</li>
    </ul>
    ```
Q18MCQ4.5 marks
question figure
Text of the picture (copyable)
You are given a project with three files: `conftest.py`, `test_multiples_of_3_and_6.py`, and `test_multiples_of_13.py`. The purpose of the tests is to verify if numbers generated by each function are divisible by 39. However, there is a setup issue in this project.

* `conftest.py` contains a fixture that provides test data.
* `test_multiples_of_3_and_6.py` has two functions: one checks divisibility by 3, and the other by 6.
* `test_multiples_of_13.py` contains a function to check divisibility by 13.

Here is the content of each file:

`conftest.py`
```python
import pytest

@pytest.fixture
def divisible_by_39():
    return 39 # Fixture providing the number to be tested
```

`test_multiples_of_3_and_6.py`
```python
import pytest

def test_divisible_by_3(divisible_by_39):
    assert divisible_by_39 % 3 == 0 # Checks if divisible by 3

def test_divisible_by_6(divisible_by_39):
    assert divisible_by_39 % 6 == 0 # Checks if divisible by 6
```

`test_multiples_of_13.py`
```python
import pytest

def test_divisible_by_13(divisible_by_39):
    assert divisible_by_39 % 13 == 0 # Checks if divisible by 13
```

When you run `pytest -k divisible`, which of the following is **true**?
  1. question figure
    text
    ```
    ========== 1 passed in 0.02s ==========
    ```
  2. question figure
    text
    ```
    ========== 3 passed in 0.02s ==========
    ```
  3. question figure
    text
    ```
    ========== 1 failed, 2 passed in 0.06s ==========
    ```
  4. question figure
    text
    ```
    ========== 3 errors in 0.02s ==========
    ```
Q19MCQ4.5 marks
question figure
Text of the picture (copyable)
A client machine and a server machine located 120 kilometers apart start moving towards each other along a straight line at 400 kmph and 800 kmph respectively. At the same time, the client starts sending requests to the server and the server sends back the response to the client. This client-server network continues to send requests and receive responses (with a new request being sent only after the response is received by the client for the previous one) until both the server and the client collide with each other. Calculate the total distance travelled (in kms) by the request data and the response data together before the two machines collide with each other?(assume the speed of request and response to be 3 x 10⁸ m/s )
  1. question figure
    text
    54 x 10⁶
  2. question figure
    text
    216 x 10⁶
  3. question figure
    text
    108 x 10⁶
  4. question figure
    text
    90 x 10^6
Q20MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following flask code.

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

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

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

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

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

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

| Column A | Column B |
|---|---|
| 1. http://127.0.0.1:5000/user/admin | a. Hello mad1 |
| 2. http://127.0.0.1:5000/admin | b. Hello Admin |
| 3. http://127.0.0.1:5000/guest/mad1 | c. /admin |
| 4. http://127.0.0.1:5000/user/mad1 | d. /guest/mad1 |
  1. 1-c, 2-b, 3-a, 4-d
  2. 1-c, 2-d, 3-a, 4-b
  3. 1-b, 2-a, 3-b, 4-d
  4. 1-b, 2-b, 3-a, 4-a
Q21MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider a flask app "app.py" and a template file "doc.html" given below:

Python file: app.py

```python
from flask import Flask, render_template

app = Flask(__name__)

itemlist = [
    {'value': '0', 'content': 'zero'},
    {'value': '1', 'content': 'one'},
    {'value': '2', 'content': 'two'},
    {'value': '3', 'content': 'three'},
]

@app.route('/')
def func():
    return render_template('doc.html', itemlist = itemlist)

app.run()
```

Template file: doc.html

```html
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"></head>
<body>
    {% macro render_field(value='field value', content='content value') %}
        <option value="{{value}}">{{content}}</option>
    {% endmacro %}

    {% for item in itemlist %}
        {{ render_field(item.content) }}
    {% endfor %}
</body>
</html>
```

If the application is running locally on http://127.0.0.1:5000. What will be the raw HTML body of the file rendered by the flask app for base url?
  1. question figure
    text
    ```html
    <body>
    
        <option value="field value">zero</option>
        <option value="field value">one</option>
        <option value="field value">two</option>
        <option value="field value">three</option>
    
    </body>
    ```
  2. question figure
    text
    ```html
    <body>
        <option value="zero">content value</option>
        <option value="one">content value</option>
        <option value="two">content value</option>
        <option value="three">content value</option>
    </body>
    ```
  3. question figure
    text
    ```html
    <body>
        <option value="0">zero</option>
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
    </body>
    ```
  4. question figure
    text
    ```html
    <body>
    
        <option value="zero">0</option>
        <option value="one">1</option>
        <option value="two">2</option>
        <option value="three">3</option>
    
    </body>
    ```
Q22MSQ3 marksselect all that apply
Which of the following statements about networking concepts (TCP, UDP, Proxy, Peer-to-Peer, Broadcast, Unicast, Multicast) are correct?
  1. TCP is a connection-oriented protocol that ensures reliable data delivery.
  2. UDP is a connectionless protocol that is faster but less reliable than TCP.
  3. Proxy servers facilitate direct peer-to-peer connections between devices.
  4. Broadcast sends a message to all devices in the network.
  5. Unicast is a one-to-many communication model.
Q23MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following route in the flask for a signup page and select the correct option:

```python
@app.route('/signup', methods=['GET', 'POST'])
def signup():
    if request.method == 'GET':
        return """<form action='/signup' method='POST'>
            <label for='username'>Username</label>
            <input type='text' name='username' required>
            <label for='password'>Password</label>
            <input type='text' name='password' required minlength="8">
            <input type='submit' value='Submit'>
        </form>
        """
    if request.method == 'POST':
        if request.form.get('username') is None:
            return redirect(url_for(signup))
        if request.form.get('password') is None:
            return redirect(url_for(signup))
        if len(request.form.get('password')) < 8:
            return redirect(url_for(signup))
        return f"<h1>Welcome, {request.form.get('username')}!</h1>"
```
  1. The signup page is dynamically generated.
  2. The signup page uses server-side rendering.
  3. The signup page uses frontend validation.
  4. The signup page uses backend validation.
Q24MSQ3 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>
```

If the user clicks on the “Click me!” button, then which of the following JS codes should be added in the `<script>` tag that will bold the content of `<input>` tag as given in the image below?

Your name : **Welcome to IITM Online BS Degree**
Click me!
  1. question figure
    text
    ```javascript
    function doSomething(){
        txt1=document.getElementById("txt1");
        txt1.style.fontWeight="bold";
    }
    ```
  2. question figure
    text
    ```javascript
    function doSomething(){
        document.getElementById("txt1").style.fontWeight="bold";
    }
    ```
  3. question figure
    text
    ```javascript
    function doSomething(){
        txt1=document.getElementById("txt1");
        txt1.style="bold";
    }
    ```
  4. question figure
    text
    ```javascript
    function doSomething(){
        document.getElementById("txt1").style="bold";
    }
    ```
Q25MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
The following Flask-RESTful API code snippet is intended to create a RESTful API for managing student registrations in an IITM BS degree program. However, there is an error in the code that prevents it from functioning correctly.

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

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

students = []

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

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

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

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

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

```python
from flask import Flask, request
valid_users = [
    {"uid": "student", "pwd": "12345"},
    {"uid": "professor", "pwd": "54321"},
    {"uid": "hod", "pwd": "abcde"},
]

app = Flask(__name__)

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

app.run(debug=True)
```

Assume the above flask app runs on "http://127.0.0.1:5000/" and is accessed through the web browser. Select the URL(s) that render **Not Found** error.
  1. question figure
    text
    http://127.0.0.1:5000/signin?uid=professor&pwd=54321
  2. question figure
    text
    ```
    http://127.0.0.1:5000/login?uid=professor&pwd=54321
    ```
  3. question figure
    text
    http://127.0.0.1:5000/signin?uid=student&pwd=12345
  4. question figure
    text
    http://127.0.0.1:5000/login?uid=student&pwd=12345
  5. question figure
    text
    http://127.0.0.1:5000/signin?uid=hod&pwd=12345
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q27MCQ2 marks
question figure
Text of the picture (copyable)
What will be the output when the
following URL is accessed?

http://127.0.0.1:5000/score/students
  1. Students Score: 120
  2. students Score : 120
  3. Team not found
  4. Score: students
Q28MCQ4.5 marks
question figure
Text of the picture (copyable)
What will happen if we access the
following URL?

http://127.0.0.1:5000/score/instructors/Dr.Prashant
  1. Dr.Prashant (Instructors) Scored: 40
  2. Dr.Prashant (Instructors) Scored: Player not found
  3. Player not found
  4. Internal Server Error
Comprehension passage - the questions below it refer to this
A college counseling system is designed to store and retrieve student records efficiently. The system uses different types of storage based on latency, throughput, and density. During peak counseling sessions, thousands of students access their academic records, appointment schedules, and previous counseling notes. The system needs to optimize storage selection for different types of data: 1. Frequently accessed small data (e.g., currently active student records) 2. Large archives of past counseling records (rarely accessed but need long-term storage) 3. Temporary session data that needs to be quickly read and updated during counseling sessions Based on the above data, answer the given subquestions.
Q29MCQ2 marks
Which of the following storage types should be used for storing frequently accessed small student records that need low latency and high-speed access?
  1. Hard Disk Drive (HDD)
  2. Solid State Drive (SSD)
  3. Static RAM (SRAM)
  4. Registers
Q30MCQ2 marks
The college wants to store archived counseling records from past students for future reference. These records are rarely accessed, but cost efficiency and storage density are important. Which storage type is best suited?
  1. Registers
  2. SRAM
  3. DRAM
  4. Hard Disk Drive (HDD)
Comprehension passage - the questions below it refer to this
question figure
Q31MSQ3 marksselect all that apply
Which of the following statements is/are True?
  1. question figure
    text
    The marks of any student object, <student>
    can be retrieved using the command
    "<student>.tests".
  2. question figure
    text
    We cannot insert a new record into the
    "**test_marks**" table for a non-existent
    student object.
  3. question figure
    text
    If a test marks record is deleted from the
    “**test_marks**” table, the related student
    record is also deleted from the “**student**”
    table.
  4. question figure
    text
    We can insert a new record in the “**student**”
    table for a non-existent “**test_marks**” object.
Q32MCQ2 marks
Which of the following is the correct way of adding records into the ‘student’ and the ‘test_marks’ tables?
  1. question figure
    text
    ```python
    >>>t1=TestMarks(id=1, test_name="quiz_1",marks=65, student_id=101)
    >>>db.add(t1)
    >>>db.commit()
    >>>s1=Student(id=101, 'RAM')
    >>>db.add(s1)
    >>>db.commit()
    ```
  2. question figure
    text
    ```python
    >>>s1=Student(id=101,name='RAM')
    >>>db.add(s1)
    >>>db.commit()
    >>>t1=TestMarks(id=1,test_name="quiz_1",marks=65,student_id=101)
    >>>db.add(t1)
    >>>db.commit()
    ```
  3. question figure
    text
    ```python
    >>>t1=TestMarks(id=1,test_name="quiz_1",marks=65,student_id=101)
    >>>s1=Student(id=101,name='RAM')
    >>>db.add(t1)
    >>>db.commit()
    >>>db.add(s1)
    >>>db.commit()
    ```
  4. question figure
    text
    ```python
    >>>t1=TestMarks(id=1,test_name="quiz_1",marks=65,student_id=101)
    >>>s1=Student(id=101,'RAM')
    >>>db.add(t1)
    >>>db.add(s1)
    >>>db.commit()
    ```

Answer key

  1. Q1 (MCQ, 2 marks): C
  2. Q2 (MCQ, 2 marks): B
  3. Q3 (MCQ, 2 marks): C
  4. Q4 (MCQ, 2 marks): D
  5. Q5 (MCQ, 3 marks): C
  6. Q6 (MCQ, 3 marks): D
  7. Q7 (MCQ, 3 marks): C
  8. Q8 (MCQ, 3 marks): D
  9. Q9 (MCQ, 3 marks): B
  10. Q10 (MCQ, 3 marks): C
  11. Q11 (MCQ, 3 marks): D
  12. Q12 (MCQ, 3 marks): A
  13. Q13 (MCQ, 3 marks): A
  14. Q14 (MCQ, 3 marks): A
  15. Q15 (MCQ, 3 marks): B
  16. Q16 (MCQ, 3 marks): A
  17. Q17 (MCQ, 4.5 marks): A
  18. Q18 (MCQ, 4.5 marks): C
  19. Q19 (MCQ, 4.5 marks): C
  20. Q20 (MCQ, 4.5 marks): D
  21. Q21 (MCQ, 4.5 marks): B
  22. Q22 (MSQ, 3 marks): A, B, D
  23. Q23 (MSQ, 3 marks): A, B, C, D
  24. Q24 (MSQ, 3 marks): A, B
  25. Q25 (MSQ, 4.5 marks): A, B
  26. Q26 (MSQ, 4.5 marks): B, D
  27. Q27 (MCQ, 2 marks): A
  28. Q28 (MCQ, 4.5 marks): B
  29. Q29 (MCQ, 2 marks): C
  30. Q30 (MCQ, 2 marks): D
  31. Q31 (MSQ, 3 marks): A, B, D
  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, and principles essential for the "Diploma Level: Modern Application Development I" exam, along with a Mermaid knowledge graph to visualize relationships.



Core Topics & Concepts

1. Flask (Python Web Framework)

2. Git & Version Control

3. HTML/CSS/JavaScript

4. Testing (Pytest)

5. Networking & Performance

6. Databases (SQLAlchemy/SQLite)

7. Storage Systems

8. Accessibility & Web Standards



Key Equations (Math/Networking)

  1. Data Transfer Time: \[ \text{Time} = \frac{\text{Distance}}{\text{Speed}} \]

    • Used in Q9, Q11, Q20 (e.g., server-client collision scenarios).
  1. Optimal Bits for Encoding: \[ \text{Bits per character} = \lceil \log_2(N) \rceil \]

    • Where \(N\) = number of unique characters (Q10).
  1. Total Data Transferred: \[ \text{Total Data} = \text{Bandwidth} \times \text{Time} \]

    • Bandwidth in Mbps, time in seconds (Q11).
  1. Relative Speed Calculation:

    • If two data centers send data simultaneously, their transfer speeds must satisfy: \[ \frac{D_1}{S_1} = \frac{D_2}{S_2} \] (Q9, where \(D\) = distance, \(S\) = speed).
  1. Collision Time: \[ \text{Time until collision} = \frac{\text{Initial Distance}}{\text{Relative Speed}} \]

    • Relative speed = \(S_1 + S_2\) (Q11, Q20).


2. Git Workflow

3. Networking Concepts

4. Testing with Pytest

5. Storage Hierarchy

6. Database Relationships (SQLAlchemy)

7. HTML/CSS/JS



Exam Tips

  1. Flask:

    • Remember {{ super() }} includes parent block content (not replaces).
    • url_for('endpoint') generates URLs dynamically.
    • Decorators (@app.route) define routes.
  1. Jinja2:

    • Loops/conditionals use {% %}; variables use {{ }}.
    • Macros are reusable with {% macro %}.
  1. Git:

    • Always checkout the target branch before merging.
  1. Networking:

    • TCP = reliable; UDP = fast.
    • Latency calculations are critical for collision scenarios.
  1. Testing:

    • Fixtures provide test data; markers filter tests.
    • pytest -m <marker> runs specific tests.
  1. Databases:

    • Foreign keys enforce relationships.
    • db.relationship defines one-to-many/many-to-one.
  1. Storage:

    • Speed: Registers > SRAM > DRAM > SSD > HDD.
    • Use Case: SRAM for cache, HDD for archives.