MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M DIPLOMA ET1 EXAM QPD1 S2 30 Apr 2023 - 30 Apr 2023

MAD1 End Term32 questions100 marks26 MCQ · 6 MSQDiploma / QPD1
Elapsed 00:00
Q1MCQ2 marks
question figure
Text of the picture (copyable)
Which of the following statements is correct for the "alt" attribute of an `<img>` tag in HTML?
  1. question figure
    text
    The "alt" attribute stores the address of an alternative image which gets loaded if the image URL specified in "src" attribute fails to load.
  2. question figure
    text
    The "alt" attribute stores an alternative text which gets displayed if the image
    URL specified in "src" attribute fails to load.
  3. question figure
    text
    It is mandatory to specify the value of "alt" attribute while using an `<img>` tag.
  4. question figure
    text
    All of these.
Q2MCQ2 marks
question figure
Text of the picture (copyable)
Which of the following would change the default templates folder to "views" in a Flask app?
  1. question figure
    text
    ```python
    app = Flask(__name__, template="views")
    ```
  2. question figure
    text
    ```python
    app = Flask(__name__, templates="views")
    ```
  3. question figure
    text
    ```python
    app = Flask(__name__, template_folder="views")
    ```
  4. question figure
    text
    ```python
    app = Flask(__name__, templates_folder="views")
    ```
Q3MCQ2 marks
Consider the following two statements and select the correct option. Statement 1: Server-level logging can only indicate which URLs were accessed Statement 2: Server-level logging can indicate if large number of requests were made in a short duration of time such as in DDoS attacks
  1. Statement 1 is true, while statement 2 is false
  2. Statement 2 is true, while statement 1 is false
  3. Both statements 1 and 2 are correct
  4. Both statements 1 and 2 are incorrect
Q4MCQ2 marks
Consider the following statements about HTML4 and HTML5 and select the correct option. Statement 1: The HTML gets separated out from SGML from its fourth version, HTML4. Statement 2: HTML5 has additional support for latest features like multimedia support, canvases etc. and it has its own parsing rules.
  1. Both statements 1 and 2 are correct.
  2. Both statements 1 and 2 are incorrect.
  3. Statement 1 is correct but statement 2 is incorrect.
  4. Statement 2 is correct but statement 1 is incorrect.
Q5MCQ2 marks
Consider the following statements and select the correct option. Statement 1: Replication is used to improve performance and decrease server load. Statement 2: Redundancy ensures data is not lost if a copy gets destroyed.
  1. Statement 1 is true & statement 2 is false
  2. Statement 2 is true & statement 1 is false
  3. Both statements 1 and 2 are true
  4. Both statements 1 and 2 are false
Q6MCQ2 marks
Read the following statements regarding web accessibility principles and choose the correct option. Statement 1: Understandable information and users interface helps developers to avoid and correct mistakes in their content. Statement 2: Perceivable information ensures that the content does not cause any seizures and physical reaction to its users.
  1. Both statement 1 and statement 2 are correct.
  2. Both statement 1 and statement 2 are incorrect
  3. Statement 1 is correct but statement 2 is incorrect
  4. Statement 1 is incorrect but statement 2 is correct
Q7MCQ2 marks
question figure
Text of the picture (copyable)
Match the first column with the second.

| 1 | HTTPS | A | must be sent with each request |
|---|---|---|---|
| 2 | Cookies | B | base64 encoding |
| 3 | Digest Authentication | C | encrypted channel |
| 4 | HTTP Basic Authentication | D | hash function |
  1. 1-C, 2-D, 3-A, 4-B
  2. 1-C, 2-A, 3-D, 4-B
  3. 1-B, 2-A, 3-D, 4-C
  4. 1-A, 2-D, 3-B, 4-C
Q8MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
What can be inferred from the ERD below?

The diagram shows two tables, "Customers" and "Orders", connected by a relationship line.

**Customers Table:**

| Column | Attribute |
|---|---|
| PK | customer_id int NOT NULL |
| | customer_name char(50) NOT NULL |

**Orders Table:**

| Column | Attribute |
|---|---|
| PK | order_id int NOT NULL |
| FK1 | customer_id int NOT NULL |
| | order_date date NOT NULL |

**Relationship:**
A curved line connects the "Customers" table to the "Orders" table.
- On the "Customers" side, the line ends with a "one-to-many" symbol (two vertical lines and a crow's foot).
- On the "Orders" side, the line ends with a "zero or one" symbol (a circle and a vertical line).
The line also has "FK1" labeled near the "Orders" table, indicating `customer_id` in "Orders" is a foreign key.
  1. A customer can exist without having any orders
  2. An order can exist without belonging to any customer
  3. A customer needs to have at least one order
  4. An order must belong to one and only one customer
Q9MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following code snippet.

```python
@app.route('/user/<username>')
def profile(username):
    # CODE BLOCK HERE
```

Assume the database has a "User" table which has a TEXT column "username". If we want the server to return a 404 status code when a user goes to the route '/user/<username>' with a username that does not exist in the database, which of the following lines would give us the desired output?
  1. question figure
    text
    ```python
    user = User.query.filter_by(username=username).first()
    if user is None:
        abort(404)
    return render_template('profile.html', user=user)
    ```
  2. question figure
    text
    ```python
    user = User.query.filter_by(username=username).first()
    if user is None:
        return render_template("404.html")
    return render_template('profile.html', user=user)
    ```
  3. question figure
    text
    ```python
    user = User.query.filter_by(username=username).first_or_404()
    return render_template('profile.html', user=user)
    ```
  4. question figure
    text
    ```python
    user = User.query.filter_by(username=username).first()
    if user is None:
        return render_template("404.html"), 404
    return render_template('profile.html', user=user)
    ```
Q10MSQ3 marksselect all that apply
Consider the following flask application running on the base URL and is accessed through a browser. Select the correct option(s). question figure Consider the following flask application running on the base URL and is accessed through a browser. Select the correct option(s).
Text of the picture (copyable)
```python
from flask import Flask, abort, request

app = Flask(__name__)

users = {
    1 : {"Name": "Ritu", "role": "Admin", "access": True},
    2 : {"Name": "Ramesh", "role": "User", "access": True},
    3 : {"Name": "Tejas", "role": "Admin", "access": True},
    4 : {"Name": "Manisha", "role": "User", "access": False}
}

@app.route('/login')
def auth():
    cred = request.args
    if users[int(cred["id"])].get("access"):
        id = int(cred["id"])
        user = users[id]
        return "Welcome, " + user.get("Name") + ", you have " \
               +user.get("role")+" access"
    else:
        abort(403)

@app.errorhandler(403)
def no_access(error):
    return "Looks like you are not an authorized user!"

app.run(debug = True)
```
  1. question figure
    text
    For the URL: http://127.0.0.1:5000/?id=2, The browser will render;
    Welcome, Ramesh, you have User access.
  2. question figure
    text
    For the URL: http://127.0.0.1:5000/login?id=1, The browser will render,
    Welcome, Ritu, you have Admin access.
  3. question figure
    text
    For the URL: http://127.0.0.1:5000/login?id=4, The browser will render,
    Welcome, Manisha, you have User access.
  4. question figure
    text
    For the URL: http://127.0.0.1:5000/login?id=4, The browser will render;
    Looks like you are not an authorized user!
Q11MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following users list.

```
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. The correct way of doing it with jinja and HTML is _________.
  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>
    ```
Q12MSQ3 marksselect all that apply
Consider the following code snippet. question figure Consider the following code snippet. Which of the following is correct regarding the coverage of the test?
Text of the picture (copyable)
```python
def foo(x,y):
    if x < 0:
        y += 1
    if y > 0:
        x -= 1
    return x + y
```

Test:
```
foo(-1, 1)
foo(1, -1)
```
  1. 100% statement coverage
  2. 100% function coverage
  3. 100% branch coverage
  4. 100% condition coverage
Q13MCQ3 marks
question figure
Text of the picture (copyable)
If $N_x$ is a number N represented in the base 'x' and the equation.

$400_a = 100_b = 256_c$

Holds for a specific set of a, b and c. The correct values of a, b and c that satisfy the above equation are:
  1. a = 8; b = 10; c = 16;
  2. a = 10; b = 2; c = 16;
  3. a = 8; b = 16; c = 10;
  4. a = 2; b = 16; c = 8;
Q14MCQ3 marks
Consider the following HTML file and select the correct option. question figure Consider the following HTML file and select the correct option.
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html lang="en">
<body>
    <table id="rows">
        <tr>
            <th>Name</th>
            <th>City</th>
        </tr>
    </table>
    <button onclick="perform()">action</button>
    <script>
        function perform(){
            let row = document.createElement("tr")
            let td1 = document.createElement("td")
            td1.innerText = "name_1"
            let td2 = document.createElement("td")
            td2.innerText = "city_1"
            row.appendChild(td1)
            row.appendChild(td2)
            let rows = document.getElementById("rows")
            rows.appendChild(row)
        }
    </script>
</body>
</html>
```
  1. The action button when clicked adds a new column to the table with value“city_1”.
  2. The action button when clicked adds a new column to the table with value“name_1”.
  3. The action button when clicked adds a new row to the table with values“name_1” in the first column and “city_1” in the second column.
  4. The action button when clicked adds a new row to the table with values “city_1”in the first column and “name_1” in the second column.
Q15MCQ3 marks
Consider a discourse forum where a user unlocks the ability to post images once he makes more than 25 posts. What kind of access control is this?
  1. Role-based access control
  2. Attribute-based access control
  3. Both role-based and attribute-based access control
  4. None of these
Q16MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Table products in SQLite database created using model class Product and the python file main.py given below.

**products:**

| id | pro_name | section |
|---|---|---|
| 1 | Pencil | stationary |
| 2 | Butter | food |
| 3 | Pencil | art |
| 4 | Face wash | cosmetics |
| 5 | Olive | vegetables |

**main.py**

```python
from jinja2 import Template
templates = """
{% if result %}
<ol>
    {% for product in products %}
    <li>{{product.pro_name}}</li>
    <li>{{product.section}}</li>
    {% endfor %}
</ol>
{% endif %}
"""

products = Product.query.filter_by(pro_name = 'Pencil').all()

Templates = Template(templates)
result = Templates.render(products = products)
print(result)
```

What will be the output on the terminal?
  1. question figure
    text
    Pencil stationary
    Pencil art
  2. question figure
    text
    ```html
    <ol>
        <li>Pencil stationary</li>
        <li>Pencil art</li>
    </ol>
    ```
  3. question figure
    text
    Pencil
    stationary
    Pencil
    art
  4. question figure
    text
    ```html
    <ol>
        <li>Pencil</li>
        <li>stationary</li>
        <li>Pencil</li>
        <li>art</li>
    </ol>
    ```
Q17MCQ3 marks
Consider the following statements regarding Continuous Integration and Continuous Deployment and select the correct option. Statement 1: As part of continuous integration, frequent, isolated changes are tested and reported on as soon as they are added to a larger code base. Statement 2: When a change is made to an application, it is automatically deployed into production using a continuous deployment strategy.
  1. Statement 1 and statement 2 both are correct.
  2. Statement 1 and statement 2 both are incorrect.
  3. Statement 1 is correct and statement 2 is incorrect.
  4. Statement 1 is incorrect and statement 2 is correct.
Q18MCQ3 marks
question figure
Text of the picture (copyable)
Match the following types of testing with their functionality.

| | |
|---|---|
| A. Black box testing | 1. Focuses primarily on input and output of the software application. |
| B. Unit testing | 2. Tests individual pieces of source code. |
| C. Grey box testing | 3. Analyzes the internal structures, the data structures, internal design, code structure, and the working of the software. |
| D. White box testing | 4. Testing the functionality of the software. In the event of errors, they can access the software code. |

Which of the following is correct matching?
  1. A → 1, B → 2, C → 4, D → 3
  2. A → 4, B → 3, C → 2, D → 1
  3. A → 4, B → 1, C → 2, D → 3
  4. A → 3, B → 2, C → 1, D → 4
Q19MCQ3 marks
question figure
Text of the picture (copyable)
What is the following HTML code is correctly represented by the DOM structure below?

Diagram: DOM structure
- "document" node.
  - "document" node connects to "root element <html>" node.
    - "root element <html>" node connects to "element <head>" node.
      - "element <head>" node connects to "element <title>" node.
    - "root element <html>" node connects to "element <body>" node.
      - "element <body>" node connects to "element <div>" node.
        - "element <div>" node connects to "element <h1>" node.
          - "element <h1>" node connects to "Text "Click Here"" node.
      - "element <body>" node connects to "element <div>" node.
        - "element <div>" node connects to "element <p>" node.
          - "element <p>" node connects to "Text "paragraph"" node.
        - "element <div>" node connects to "element <a>" node.
          - "element <a>" node connects to "attribute href="#" " node.
          - "element <a>" node connects to "Text "Click Here"" node.
  1. question figure
    text
    ```html
    <html>
    <head>
        <title>My website</title>
    </head>
    <body>
        <div>
            <h1> Header </h1>
            <p><a href="#"> Click Here </a></p>
        </div>
    </body>
    </html>
    ```
  2. question figure
    text
    ```html
    <html>
    <head>
        <title>My website</title>
    </head>
    <body>
        <div>
            <h1> Header </h1>
        </div>
        <div>
            <p> <a href="#"> Click Here </a> </p>
        </div>
    </body>
    </html>
    ```
  3. question figure
    text
    ```html
    <html>
    <head>
        <title>My website</title>
    </head>
    <body>
        <div>
            <h1> Header </h1>
        </div>
        <div>
            <p>Paragraph</p>
            <a href="#"> Click Here </a>
        </div>
    </body>
    </html>
    ```
  4. question figure
    text
    ```html
    <html>
    <head>
        <title>My website</title>
    </head>
    <body>
        <h1> Header </h1>
        <p><a href="#"> Click Here </a></p>
    </body>
    </html>
    ```
Q20MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following table "emp" created in SQLite database corresponding to model class "Employee" using flask_sqlalchemy.

| Id | Name | Designation | Gender | Salary |
|---|---|---|---|---|
| 1 | Raji | Headmaster | Female | 4500 |
| 2 | Ram | Teacher | Male | 5000 |
| 3 | Raveena | Teacher | Female | 3000 |
| 4 | Reshma | Technical staff | Female | 2000 |
| 5 | Ravi | Teacher | Male | 1000 |

Which of the following code snippets correctly increases the salary of all the teachers by 1000 Rupees when typed in the Python console?
  1. question figure
    text
    ```python
    >>> emp = Employee.query.filter_by(Designation = 'Teacher').all()
    >>> for staff in emp:
    ...     staff.Salary += 1000
    ... 
    >>> db.session.commit()
    ```
  2. question figure
    text
    ```python
    >>> emp = Employee.query.filter_by(Gender = 'Female').all()
    >>> staff.Salary += 1000
    >>> db.session.commit()
    ```
  3. question figure
    text
    ```python
    >>> emp = Employee.query.filter_by(Gender = 'Female').all()
    >>> for staff in emp:
    ...     staff.Salary += 1000
    ...
    >>> db.session.commit()
    ```
  4. question figure
    text
    ```python
    >>>emp = Employee.query.filter(Employee.Gender.like('T%')).all()
    >>> for staff in emp:
    ...     staff.Salary += 1000
    ... 
    >>> db.session.commit()
    ```
Q21MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

```python
from math import factorial

def prettify(func):
    def wrapper(num):
        try:
            return func(num)
        except:
            return "Please check your number!"
    return wrapper

@prettify
def fact(num):
    return factorial(num)

out = fact(-4)
print(out)
```

What will the output if the above Python code is run on the terminal?
  1. question figure
    text
    -24
  2. question figure
    text
    24
  3. question figure
    text
    Please check your number!
  4. question figure
    text
    None
Q22MCQ3 marks
question figure
Text of the picture (copyable)
Read the following statements regarding web accessibility principles and choose the correct option.

**Statement 1:** The command `git merge <branch_name>` merges all the change done to currently active branch.

**Statement 2:** The command `git merge <branch_name>` merges all the change done to master branch.
  1. Both statement 1 and statement 2 are correct
  2. Both statement 1 and statement 2 are incorrect
  3. Statement 1 is correct but statement 2 is incorrect
  4. Statement 1 is incorrect but statement 2 is correct
Q23MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider a function remainder, and a set of test cases given below.

Filename: test_file.py

```python
def remainder(numerator, denominator):
    rem = numerator % denominator
    return rem

def test_func0():
    assert remainder(5,7) == 5

def test_function1():
    assert remainder(20,4) == 3

def test_func2():
    assert remainder(31,8) == 6

def test_function3():
    assert remainder(2,3) == 2
```

What will be the output on the terminal for the command `pytest test_file.py -k func`?
  1. question figure
    text
    ```
    ======== 1 failed, 1 passed, 2 deselected in 0.41s ========
    ```
  2. question figure
    text
    ```text
    ============================= 2 passed, 2 deselected in 0.41s =============================
    ```
  3. question figure
    text
    ```text
    ============================= 2 failed, 2 passed in 0.41s =============================
    ```
  4. question figure
    text
    ```
    ========== 2 failed, 2 deselected in 0.41s ==========
    ```
Q24MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following models Library and Book corresponding to tables library and book in SQLite database.

```python
class Library(db.Model):
    id = db.Column(db.Integer(), primary_key = True)
    name = db.Column(db.String(), unique = True)

class Book(db.Model):
    id = db.Column(db.Integer(), primary_key = True)
    name = db.Column(db.String(), unique = True)
    library = db.Column(db.Integer(), unique = True, db.ForeignKey("library.id"))
```

Based on the model schemas, what relationship do the classes Library and Book share?
  1. Many-to-Many
  2. One-to-Many
  3. One-to-One
  4. The tables are not at all related
Q25MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the `<span>` element and the styling given to it in `<style>` tag using element selector in the HTML file below.

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Span</title>
    <style>
        span{
            color: red;
            border:1px solid blue;
        }
    </style>
</head>
<body>
    <span id="this_span">Hello Students! MAD-I welcomes you!</span>
</body>
</html>
```

What will be the final style applied to `<span>` tag if an additional style is added via the ID selector given below?

```css
#this_span{
    width: 1200px;
    border: 2px solid pink;
}
```
  1. question figure
    text
    ```css
    color: red;
    width: 1200px;
    border: 2px solid pink;
    ```
  2. question figure
    text
    ```css
    color: red;
    width: 1200px;
    border: 1px solid blue;
    ```
  3. question figure
    text
    ```css
    color: red;
    border: 2px solid pink;
    ```
  4. question figure
    text
    ```css
    width: 1200px;
    border: 2px solid pink;
    ```
Q26MCQ4.5 marks
question figure
Text of the picture (copyable)
Software packages A and B of complexity O(n²logn) and O(n³), respectively,
spend exactly T_A(n) = C_A n²log₁₀(n) and T_B(n) = C_B n³ milliseconds to process n data
items. During a test, the average time of processing n = 10⁵ data items with the package
A and B is 600 milliseconds and 300 milliseconds, respectively. Which of two software
packages defined above will work better to process 10⁶ data items?
  1. Software package A
  2. Software package B
  3. Both Software packages A and B will take same time to process 106 items
  4. Both Software packages A and B will take infinitely long time to process 106items
Q27MCQ4.5 marks
Consider the following Python code snippet. question figure Consider the following Python code snippet. How will the browser render the output of the above given Python code?
Text of the picture (copyable)
```python
from jinja2 import Template

data = [
    {"vehicle_id":"ev101", "vehicle_name":"electroN", "fuel_type":"electric"},
    {"vehicle_id":"pt201", "vehicle_name":"discover", "fuel_type":"petrol"},
    {"vehicle_id":"dz301", "vehicle_name":"apex", "fuel_type":"diesel"},
]

this_text = """
<h1> Ordered Vehicles </h1>
{% set keys = data[0].keys() %}
{% set keys = keys|list %}
{% for i in range(data|length) %}
{{keys[i]}} : {{data[i][keys[i]]}}
{% endfor %}
<h3> Total: {{ data|length }} </h3>
"""

this_temp = Template(this_text)
rendered = this_temp.render(data = data[::-1])
print(rendered)
```
  1. question figure
    text
    Ordered Vehicles
    
    vehicle_id : pt201
    
    vehicle_name : discover
    
    fuel_type : petrol
    
    Total: 3
  2. question figure
    text
    Ordered Vehicles
    
    vehicle_id : ev101
    
    vehicle_name : electroN
    
    fuel_type : electric
    
    Total: 3
  3. question figure
    text
    Ordered Vehicles
    
    vehicle_id : ev101
    
    vehicle_name : discover
    
    fuel_type : diesel
    
    Total: 3
  4. question figure
    text
    Ordered Vehicles
    
    vehicle_id : dz301
    
    vehicle_name : discover
    
    fuel_type : electric
    
    Total: 3
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q28MCQ4.5 marks
At what distance (kms) should the router be placed from the client so that round-trip latency of the network remains as low as 110 milliseconds?
  1. 6000 kilometers
  2. 4500 kilometers
  3. 7500 kilometers
  4. 8000 kilometers
Q29MCQ3 marks
What will be the round-trip latency (milliseconds) of the network if the router is placed at exactly midway from the client and the server?
  1. 6
  2. 60
  3. 110
  4. 120
Q30MSQ2 marksselect all that apply
Consider the Amazon Alexa device. Which of the following would constitute the view of the application behind such a device?
  1. The AI voice
  2. The LED light around the device
  3. The body of the device
  4. None of these
Comprehension passage - the questions below it refer to this
question figure
Q31MCQ4.5 marks
question figure
Text of the picture (copyable)
Which of the following URL will
return a 200 OK for GET HTTP
method?
  1. question figure
    text
    ```
    http://127.0.0.1:5000/maharastra/mumbai
    ```
  2. question figure
    text
    ```
    http://127.0.0.1:5000/india?state=tamilnadu&capital=chennai
    ```
  3. question figure
    text
    ```
    http://127.0.0.1:5000/india/madhyapradesh/bhopal
    ```
  4. question figure
    text
    ```
    http://127.0.0.1:5000?state=rajasthan&capital=jaipur
    ```
Q32MCQ4.5 marks
question figure
Text of the picture (copyable)
Which of the following URL
will return a 200 OK for POST
HTTP method?
  1. question figure
    text
    ```
    http://127.0.0.1:5000/india?state=odisha&capital=bhubaneshwar
    ```
  2. question figure
    text
    ```
    http://127.0.0.1:5000?state=telangana&capital=hyderabad
    ```
  3. question figure
    text
    ```
    http://127.0.0.1:5000/karnataka/bangalore
    ```
  4. question figure
    text
    ```
    http://127.0.0.1:5000/india/westbengal/kolkata
    ```

Answer key

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


1. Core Topics & Concepts

A. Web Development (HTML, Flask, Jinja2)

Key Concepts:

  1. HTML Attributes & Accessibility

    • alt attribute in <img>: Provides alternative text for accessibility (e.g., screen readers) or when the image fails to load.
    • Semantic HTML5: Supports multimedia (<video>, <audio>, <canvas>), parsing rules, and separation from SGML (unlike HTML4).
  1. Flask Framework

    • Template Folder Customization:

      app = Flask(__name__, template_folder="views")  # Changes default templates folder to "views"
    • Routing & Error Handling:

      @app.route('/user/<username>')
      def profile(username):
          user = User.query.filter_by(username=username).first_or_404()  # Returns 404 if user not found
          return render_template('profile.html', user=user)
    • HTTP Methods:

      • GET: Retrieve data (e.g., query parameters via request.args).
      • POST: Submit data (e.g., form data via request.form).
    • Jinja2 Templating:

      • Loop through lists:

        <ol>
          {% for user in users %}
            <li><a href="/show_users/{{ user.id }}">{{ user.name }}</a></li>
          {% endfor %}
        </ol>
      • Conditional rendering:

        {% if user.access %}
          <p>Welcome, {{ user.name }}!</p>
        {% else %}
          <p>Access denied.</p>
        {% endif %}
  1. Database Integration (SQLAlchemy)

    • Relationships:

      • One-to-Many: Foreign key in the "many" side (e.g., Book.library_id references Library.id).
      • One-to-One: unique=True in the foreign key column.
    • Querying:

      teachers = Employee.query.filter_by(Designation='Teacher').all()
      for teacher in teachers:
          teacher.Salary += 1000
      db.session.commit()
  1. RESTful APIs (Flask-RESTful)

    • Define resources with HTTP methods:

      class TestApi(Resource):
          def get(self):
              return {"data": request.args}  # Handles GET requests
          def post(self, state, city):
              return {"state": state, "capital": city}  # Handles POST requests
      api.add_resource(TestApi, '/india', '/india/<state>/<city>')

B. Web Security & Performance

  1. Authentication Methods | Method | Description | |----------------------|--------------------------------------| | HTTP Basic Auth | Base64-encoded credentials. | | Digest Auth | Uses hash functions (more secure). | | HTTPS | Encrypted channel (TLS/SSL). | | Cookies | Must be sent with each request. |
  1. Logging & DDoS Protection

    • Server logs can detect:

      • Accessed URLs.
      • High request volumes (e.g., DDoS attacks).
  1. Access Control Models

    • Role-Based Access Control (RBAC): Permissions tied to roles (e.g., "Admin").
    • Attribute-Based Access Control (ABAC): Permissions tied to attributes (e.g., "post_count > 25").
  1. Web Accessibility (WCAG Principles)

    • Perceivable: Content must be presentable in different forms (e.g., alt text for images).
    • Understandable: Clear navigation and error prevention.

C. Software Engineering Principles

  1. Testing

    • Types of Testing: | Type | Description | |--------------------|----------------------------------------------| | Black Box | Tests input/output without code knowledge. | | White Box | Tests internal structures (code coverage). | | Grey Box | Partial code knowledge (e.g., API tests). | | Unit Testing | Tests individual functions. |
    • Coverage Metrics:

      • Statement Coverage: All lines executed.
      • Branch Coverage: All branches (e.g., if/else) executed.
      • Example:

        def foo(x, y):
            if x < 0: y += 1      # Branch 1
            if y > 0: x -= 1      # Branch 2
            return x + y

        Tests foo(-1, 1) and foo(1, -1) achieve 100% branch coverage.

  1. Version Control (Git)

    • git merge <branch>: Merges changes into the currently active branch (not necessarily master).
  1. CI/CD (Continuous Integration/Deployment)

    • CI: Automated testing of isolated changes.
    • CD: Automated deployment to production.

D. Data Structures & Algorithms

  1. Entity-Relationship Diagrams (ERD)

    • Example:

      Customers (PK: customer_id) → Orders (FK: customer_id)
      • Inferences:

        • One-to-many: One customer can have multiple orders.
        • Foreign keys enforce referential integrity.
  1. Time Complexity

    • Compare algorithms for large inputs (e.g., \(O(n^2 \log n)\) vs. \(O(n^3)\)).
    • Example:

      • \(T_A(n) = c_A n^2 \log n\) (Package A)
      • \(T_B(n) = c_B n^3\) (Package B)
      • For \(n = 10^5\), if \(T_A = 600\)ms and \(T_B = 300\)ms, solve for \(c_A\) and \(c_B\) to predict performance at \(n = 10^6\).

E. Networking

  1. Latency Calculation

    • Round-trip time (RTT) depends on:

      • Distance (\(d\)).
      • Speed of light in medium (\(v\)):

        • Cable: \(1.5 \times 10^8\) m/s.
        • Air: \(3 \times 10^8\) m/s.
    • Formula: \[ \text{RTT} = 2 \times \left( \frac{d_1}{v_1} + \frac{d_2}{v_2} \right) \]
    • Example: Client-server distance = 12,000 km, router at midpoint.

      • Cable segment: 6,000 km → \(t_1 = \frac{6000 \times 10^3}{1.5 \times 10^8} = 0.04\) s.
      • Air segment: 6,000 km → \(t_2 = \frac{6000 \times 10^3}{3 \times 10^8} = 0.02\) s.
      • Total RTT = \(2 \times (0.04 + 0.02) = 120\) ms.

F. Mathematics (Number Bases)

  1. Base Conversion

    • Equation: \(400_a = 100_b = 256_c\).
    • Solve for \(a, b, c\) by converting to base 10: \[ 4a^2 + 0 + 0 = 1b^2 + 0 + 0 = 2c^2 + 5c + 6 \]
    • Solution: \(a = 8\), \(b = 16\), \(c = 10\).

2. Key Equations

TopicEquation
Time Complexity\(T_A(n) = c_A n^2 \log n\), \(T_B(n) = c_B n^3\)
Latency\(\text{RTT} = 2 \times \left( \frac{d_1}{v_1} + \frac{d_2}{v_2} \right)\)
Base Conversion\(400_a = 4a^2 = 100_b = b^2 = 256_c = 2c^2 + 5c + 6\)

Graph 2: Security & Performance

Graph 3: Software Engineering

Graph 4: Networking & Math


4. Exam Tips

  1. Flask/Jinja2: Focus on routing, template rendering, and database queries.
  2. HTML: Understand alt, semantic tags, and DOM structure.
  3. Testing: Know the difference between coverage types (statement vs. branch).
  4. Networking: Memorize latency formulas and base conversion steps.
  5. Git: git merge affects the current branch, not always master.