MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M FOUNDATION AN EXAM ADF3 24 Dec 2023 - 24 Dec 2023

MAD1 End Term32 questions100 marks24 MCQ · 8 MSQFoundation / afternoon
Elapsed 00:00
Q1MCQ3 marks
question figure
Text of the picture (copyable)
Consider the given URL below.

```
https://seek.study.iitm.ac.in/courses/ns_23t3_cs2003?type=lesson&tab=course
s
```

Select the appropriate option that correctly identifies different components of a given URL.
  1. question figure
    text
    ```
    Protocol: https
    Domain: seek
    Sub-Domain: study.iitm.ac.in
    Path: /courses/ns_23t3_cs2003
    Parameters: ?type=lesson&tab=courses
    ```
  2. question figure
    text
    ```
    Protocol: https
    Domain: seek
    Sub-Domain: study.iitm.ac.in/courses
    Path: /ns_23t3
    Parameters: cs2003?type=lesson&tab=courses
    ```
  3. question figure
    text
    ```
    Protocol: https
    Domain: study.iitm.ac.in/courses
    Sub-Domain: seek
    Path: /ns_23t3
    Parameters: cs2003?type=lesson&tab=courses
    ```
  4. question figure
    text
    ```
    Protocol: https
    Domain: study.iitm.ac.in
    Sub-Domain: seek
    Path: /courses/ns_23t3_cs2003
    Parameters: ?type=lesson&tab=courses
    ```
Q2MCQ3 marks
How will the browser render the following HTML document? question figure How will the browser render the following HTML document?
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <style>
        div{
            border: 1px solid black;
            color:pink;
        }
        span{
            border: 1px solid pink;
            display: block;
        }
        div,span{
            width:8%;
            margin: 2px;
        }
    </style>
</head>
<body>
    <div>Div 1</div>
    <div>Div 2</div>
    <span>Span 1</span>
    <span>Span 2</span>
</body>
</html>
```
  1. question figure
    text
    Div 1
    Div 2
    Span 1
    Span 2
  2. question figure
    text
    This is a UI screenshot showing four text elements, each enclosed in a rectangular border.
    The top row has two elements:
    - "Div 1" (text in light red, black border)
    - "Div 2" (text in light red, black border)
    The second row has one element:
    - "Span 1" (text in black, black border)
    The third row has one element:
    - "Span 2" (text in black, light red border)
  3. question figure
    text
    Div 1 Div 2 Span 1 Span 2
  4. question figure
    text
    Div 1
    Div 2
    Span 1
    Span 2
Q3MCQ3 marks
Consider the statements given below and choose the correct option. Statement 1: 100% statement coverage automatically implies 100% branch coverage. Statement 2: 100% statement coverage automatically implies 100% condition coverage.
  1. Both statement 1 and 2 are correct.
  2. Both statement 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.
Q4MCQ3 marks
question figure
Text of the picture (copyable)
Consider a simple web server using command prompt.
Filename - Hello.sh
```bash
#!/bin/bash
while true; do
echo -e "Current date and time is \n\t $(date)"
| nc -l localhost 4100;
done
```
If this program creates a server in a terminal, the correct way to make a request to this server is ______.
  1. question figure
    text
    Type `curl http://localhost:5000` in the same terminal where the server is running.
  2. question figure
    text
    Type `curl http://localhost:4100` in the same terminal where the server is running.
  3. question figure
    text
    Open a new terminal and type `curl http://localhost:5000`
  4. question figure
    text
    Open a new terminal and type `curl http://localhost:4100`
Q5MCQ3 marks
Consider the following flask application. question figure Consider the following flask application.
Text of the picture (copyable)
Python file: app.py

```python
from flask import Flask, render_template, request

app = Flask(__name__)

emp = {'admin':'manoj', 'user':'sumit'}

@app.route('/profile/<user>')
def profile(user):
    access = request.args.get('access')
    if emp[access] != user:
        return render_template("profile.html", user = user,
                               access = access, error = True)
    return render_template("profile.html", user = user,
                           access = access, error = False)

app.run()
```

Template file: profile.html

```html
<body>
    <div>
        {% if error %}
            <h3>Hi {{user}}, {{access}} access denied</h3>
        {% else %}
            <h3>Hi {{user}}, you are logged in as {{access}}.</h3>
        {% endif %}
    </div>
</body>
```

If the application is running locally on http://127.0.0.1:5000, then what will be rendered by the browser for URL,
http://127.0.0.1:5000/profile/sumit?access=admin ?
  1. question figure
    text
    Hi sumit, you are logged in as admin.
  2. question figure
    text
    Hi sumit, you are logged in as user.
  3. question figure
    text
    Hi sumit, admin access denied.
  4. question figure
    text
    Hi sumit, user access denied.
Q6MCQ3 marks
Consider the following function to be tested and test functions given in the Python code snippet below. question figure Consider the following function to be tested and test functions given in the Python code snippet below.
Text of the picture (copyable)
test_file.py

```python
import pytest

def square(x):
    sum = 0
    for counter in range(x):
        sum += x
    return sum

@pytest.mark.marker1
def testcase_1():
    assert square(13) == 144

@pytest.mark.marker2
def testcase_2():
    assert square(6) == 6

@pytest.mark.marker3
def testcase_3():
    assert square(3) == 9
```

On running this file on the terminal using pytest, the summary of the output is;
============================= 1 passed, 2 deselected, 3 warnings in 0.02s =============================

What command will result into the outcome given above?
  1. question figure
    text
    ```
    pytest test_file.py -k marker1
    ```
  2. question figure
    text
    ```
    pytest test_file.py -m marker1
    ```
  3. question figure
    text
    ```
    pytest test_file.py -m marker3
    ```
  4. question figure
    text
    ```
    pytest test_file.py -m marker2
    ```
Q7MCQ3 marks
question figure
Text of the picture (copyable)
The hexadecimal equivalent of the IPv4 address 171.216.21.100 would be
____________.
  1. ABD8 6415
  2. D8AB 6415
  3. ABD8 1564
  4. D8AB 1564
Q8MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following models Creator and Song corresponding to tables creator and song in SQLite database.

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

class Song(db.Model):
    id = db.Column(db.Integer(), primary_key = True)
    s_title = db.Column(db.String(), unique = True)
    singer = db.Column(db.Integer(), db.ForeignKey("creator.id"))
```

Based on the model schemas, what relationship do the table creator and song share?
  1. Many-to-Many
  2. One-to-Many
  3. One-to-One
  4. The tables are not at all related
Q9MCQ3 marks
Which curl option is used to set the request method in an HTTP request?
  1. -H
  2. -X
  3. -d
  4. -r
Q10MCQ2 marks
Read the statements given below carefully and select the correct option. Statement 1: If an element is styled externally using both the class and the ID, then for the same attribute, it will acquire styling from the ID. Statement 2: If an element is styled internally using ID and class selector as well as using inline styling for the same style attribute, then it will always acquire inline styling.
  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
Q11MCQ2 marks
Consider two python files, one.py and two.py with following code snippets. question figure Consider two python files, one.py and two.py with following code snippets. What is the output of the following command “python one.py two.py two.py one.py ”?
Text of the picture (copyable)
File1: one.py
```python
import sys
import two
print(f'{sys.argv[1]} {sys.argv[3]}')
```

File2: two.py
```python
import sys
print(f'{sys.argv[2]} {sys.argv[0]}')
```
  1. question figure
    text
    one.py two.py
    one.py two.py
  2. question figure
    text
    two.py one.py
    one.py two.py
  3. question figure
    text
    two.py one.py
    two.py one.py
  4. question figure
    text
    one.py two.py
    two.py one.py
Q12MCQ2 marks
Which of the following is not a web component?
  1. Custom Elements
  2. Shadow DOM
  3. HTML Templates
  4. Web Assembly
Q13MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following statements and select the correct option.

**Statement 1:** The command, `git del <filename>` deletes the file from the staging area as well as from the working tree.

**Statement 2:** The command, `git rm --cached <filename>` deletes the file from the staging area but keeps it in the working tree.
  1. Statement 1 is correct, but statement 2 is incorrect.
  2. Statement 1 is incorrect, but statement 2 is correct.
  3. Both statements 1 and 2 are correct.
  4. Both statements 1 and 2 are incorrect.
Q14MCQ2 marks
What is Emscripten in the context of WebAssembly?
  1. A WebAssembly specification
  2. A JavaScript framework
  3. A toolchain for compiling C/C++ code to WebAssembly
  4. An HTML and CSS editor
Q15MCQ2 marks
The ORM(Object-Relational Mapping) sqlalchemy is used for?
  1. Running SQL queries directly on the database
  2. Defining the structure of HTML templates
  3. Mapping Python objects to database tables and records
  4. Creating Web Routes in a Flask app
Q16MCQ4.5 marks
Consider the following Python code snippet. question figure Consider the following Python code snippet.
Text of the picture (copyable)
arg.py
```python
from jinja2 import Template
import sys
input_list = sys.argv
num1, num2, input_list[3] = int(input_list[1]), int(input_list[2]), int(input_list[3])

if input_list[3]== 1:
    num3= (num1**num2)
elif input_list[3]== 2:
    num3= (num1-num2)
elif input_list[3]== 3:
    num3= (num1+num2)
else:
    num3= (num1%num2)
template = """
<!DOCTYPE html>
<html>
<div>
    Number 1: {{num1}},
    Number 2: {{num2}},
    Output : {{num3}}
</div>
</html>
"""

t = Template(template)
print(t.render(num1=num1, num2=num2, num3=num3))
```
Map the commands in column A with the correct rendered output in the browser in column B.

| Column A | Column B |
|---|---|
| a) python arg.py 2 2 1 | 1) Number 1: 4, Number 2: 2, Output : 0 |
| b) python arg.py 2 2 3 | 2) Number 1: 2, Number 2: 2, Output : 4 |
| c) python arg.py 4 2 2 | 3) Number 1: 2, Number 2: 2, Output : 4 |
| d) python arg.py 4 2 4 | 4) Number 1: 4, Number 2: 2, Output : 2 |
  1. a - 3, b - 2, c - 1, d - 4
  2. a - 2, b - 1, c - 4, d - 3
  3. a - 3, b - 1, c - 2, d - 4
  4. a - 2, b - 3, c - 4, d - 1
Q17MCQ4.5 marks
Given a Python code snippet, code.py is run on the terminal with an appropriate temp.html document. question figure Given a Python code snippet, code.py is run on the terminal with an appropriate temp.html document.
Text of the picture (copyable)
code.py
```python
from jinja2 import Template

Products = [
    {'product_id':'101', 'prod_name':'Legion', 'producer':'Lenovo'},
    {'product_id':'102', 'prod_name':'S21pro', 'producer':'Samsung'},
    {'product_id':'103', 'prod_name':'TabA7', 'producer':'Samsung'},
    {'product_id':'104', 'prod_name':'Ideapad', 'producer':'Lenovo'},
]

File = open ('temp.html','r')
temp = File.read()
File.close()
made_temp = Template(temp)
print(made_temp.render(Products=Products))
```

What should be the content of temp.html file if the browser renders the output of the above code, as shown below;

Lenovo

| Product ID | Name    |
|:-----------|:--------|
| 101        | Legion  |
| 104        | Ideapad |

Samsung

| Product ID | Name   |
|:-----------|:-------|
| 102        | S21pro |
| 103        | TabA7  |
  1. question figure
    text
    ```html
    {% for product in Products| groupby('producer') %}
    <p> {{product.grouper}} </p>
    <table border="1">
    <tr>
    <th>Product ID</th>
    <th> Name </th>
    </tr>
    <tr>
    <td> {{ product.product_id}}</td>
    <td>{{product.prod_name}}</td>
    </tr>
    </table>
    {% endfor %}
    ```
  2. question figure
    text
    ```html
    {% for product in Products| groupby('producer') %}
    <p> {{product.grouper}} </p>
    <table border="1">
    <tr>
    <th>Product ID</th>
    <th> Name </th>
    </tr>
    {% for item in product.list %}
    <tr>
    <td> {{ item.product_id}}</td>
    <td>{{item.prod_name}}</td>
    </tr>
    {% endfor %}
    </table>
    {% endfor %}
    ```
  3. question figure
    text
    ```html
    {% for product in Products| groupby('prod_name') %}
    <p> {{product.grouper}} </p>
    <table border="1">
    <tr>
    <th>Product ID</th>
    <th> Name </th>
    </tr>
    {% for item in product.list %}
    <tr>
    <td> {{ item.product_id}}</td>
    <td>{{item.prod_name}}</td>
    </tr>
    {% endfor %}
    </table>
    {% endfor %}
    ```
  4. question figure
    text
    ```html
    {% for product in Products| groupby('prod_name') %}
        <p>{{product.grouper}}</p>
        <table border="1">
            <tr>
                <th>Product ID</th>
                <th>Name</th>
            </tr>
            <tr>
                <td>{{item.product_id}}</td>
                <td>{{item.prod_name}}</td>
            </tr>
        </table>
    {% endfor %}
    ```
Q18MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following function to be tested and test functions given in the Python code snippet below.

test_file.py

```python
powers = []

for i in range(1,5):
    def powers_of_x(x):
        return x**i
    powers.append(powers_of_x)

powers_of_3 = [x(3) for x in powers]

def testcase_1():
    assert 9 in powers_of_3

def testcase_2():
    assert 27 in powers_of_3

def testcase_3():
    assert 64 in powers_of_3
```

For the command `pytest test_file.py`, what will be the output on the terminal?
  1. question figure
    text
    ```
    ============================= 1 failed, 2 passed in 0.02s =============================
    ```
  2. question figure
  3. question figure
    text
    ```
    ======================================== 3 failed in 0.02s ========================================
    ```
  4. question figure
    text
    ```
    ============================= 2 failed, 1 passed in 0.02s =============================
    ```
Q19MCQ4.5 marks
Consider the following HTML document rendered using a browser. question figure Consider the following HTML document rendered using a browser.
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <style>
        input:valid {
            background: green;
        }
        input:invalid {
            background: red;
        }
    </style>
</head>
<body>
    <form>
        <label for="uname">Enter a valid e-mail:</label>
        <input type="text" name="uname" minlength="5"
               maxlength="8" value="a">
    </form>
</body>
</html>
```
If a user starts typing "madcourse" letter by letter, how will the background colour of the
`<input>` tag change?
  1. Red for first five letters, turns green till 8th letter and turns red back againafter next letter.
  2. Red for first five letters, and remain green after that.
  3. Green for first five letters, turns red till 8th letter and turns green back againafter next letter.
  4. Green for first five letters, and remain red after that.
Q20MCQ4.5 marks
question figure
Text of the picture (copyable)
A flask application shown below is running locally on http://127.0.0.1:5000

```python
from flask import Flask, request, session, abort

app = Flask(__name__)
app.config['SECRET_KEY'] = "yekterces"

@app.route('/login')
def log_in():
    user = request.args['user']
    role = request.args['role'] if 'role' in request.args else 'general'
    session['user'], session['role'] = user, role
    return "Logged in successfully!"

@app.route('/home')
def land():
    if 'user' in session:
        if session['role'] == 'admin':
            return f"Welcome {session['user']}"
        return abort(401)
    return abort(404)

@app.route('/logout')
def log_out():
    session.pop('user', None)
    session.pop('role', None)
    return "Logged out sucessfully!"

app.run(debug=True)
```

If the application is running locally on http://127.0.0.1:5000, What will be the correct sequence of response status codes if the client visits the URLs one by one in the sequence given below?

1. http://127.0.0.1:5000/home
2. http://127.0.0.1:5000/login/admin
3. http://127.0.0.1:5000/login?user=admin
4. http://127.0.0.1:5000/home
5. http://127.0.0.1:5000/logout
  1. question figure
    text
    401
    401
    200
    404
    200
  2. question figure
    text
    404
    404
    200
    401
    200
  3. question figure
    text
    404
    200
    200
    200
    200
  4. question figure
    text
    404
    200
    404
    200
    200
Q21MSQ3 marksselect all that apply
Consider the following two code snippets. question figure Consider the following two code snippets. Which of the following is/are correct options if the above snippets are run as view functions of a flask application ?
Text of the picture (copyable)
Snippet 1

```python
@app.route("/base")
@app.route("/home")
def homepage():
    return "Welcome to MAD I!"
```

Snippet 2

```python
@app.route("/mad1")
def homepage():
    return "Welcome to MAD I!"

@app.route("/mad2")
def homepage():
    return "Welcome to MAD II!"
```
  1. Snippet 1 is valid, but Snippet 2 is invalid.
  2. Snippet 2 is valid, but Snippet 1 is invalid.
  3. Snippet 1 will run successfully, while Snippet 2 will raise an AssertionError.
  4. Snippet 2 will run successfully, while Snippet 1 will raise an AssertionError.
Q22MSQ3 marksselect all that apply
Consider the following flask application. question figure Consider the following flask application.
Text of the picture (copyable)
app.py

```python
from flask import Flask, render_template, url_for, request, redirect
app = Flask(__name__)
list_of_courses = ['Java', 'Python', 'DBMS', 'PDSA']

@app.route("/if")
def if_loop():
    name = request.args.get("name")
    if name == "MADI":
        return redirect("/home")
    elif name in list_of_courses:
        return url_for("for_loop")
    return "You are not authorized to view this page"

@app.route("/home")
def home_page():
    return "Welcome to MADI!"

@app.route("/for")
def for_loop():
    return render_template("for_course.html", courses=list_of_courses)

app.run(debug=True)
```
Which of the following statements is/are true if the application is running locally on http://127.0.0.1:5000 ?
  1. question figure
    text
    For URL, http://127.0.0.1:5000/if?name=MADI browser will display,
    /home as output.
  2. question figure
    text
    For URL, http://127.0.0.1:5000/if?name=Java browser will render,
    for_course.html
  3. question figure
    text
    For URL http://127.0.0.1:5000/if browser will display,
    You are not authorized to view this page! as output.
  4. question figure
    text
    For URL http://127.0.0.1:5000/if?name=Python browser will display,
    /for as output.
Q23MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the ER diagram below.

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

Orders
| PK | order_id int NOT NULL |
|---|---|
| FK1 | customer_id int NOT NULL |
| | order_date date NOT NULL |

The ER diagram shows two tables, "Customers" and "Orders", connected by a relationship.
The "Customers" table has two columns:
- `customer_id` (Primary Key, integer, NOT NULL)
- `customer_name` (character varying of length 50, NOT NULL)

The "Orders" table has three columns:
- `order_id` (Primary Key, integer, NOT NULL)
- `customer_id` (Foreign Key 1, integer, NOT NULL)
- `order_date` (date, NOT NULL)

There is a relationship line connecting `customer_id` in the "Customers" table to `customer_id` in the "Orders" table.
The "Customers" side of the relationship has a double vertical line (representing "one and only one").
The "Orders" side of the relationship has a circle and a crow's foot (representing "zero or many").

Which of the following statement is/are correct?
  1. One order must have exactly one customer associated with it.
  2. One customer must have many orders associated with it.
  3. One customer may have zero or many orders associated with it.
  4. It's not mandatory for a customer to have an order.
Q24MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
The table "student" in SQLite database is used by an application.

| ID | Name | Age | Marks | Courses |
|---|---|---|---|---|
| 102 | Ravi | 21 | 45 | Geography |
| 105 | Ashnoor | 22 | 80 | Physics |
| 109 | Kavya | 20 | 71 | Mathematics |
| 114 | Vivek | 25 | 63 | Chemistry |

Which of the following SQL commands will change the state of the database server?
  1. question figure
    text
    ```sql
    CREATE TABLE Student (ID int NOT NULL, Name varchar(255) NOT NULL,
    Age int, Marks int, Courses varchar(255), PRIMARY KEY (ID));
    ```
  2. question figure
    text
    ```sql
    SELECT * from Student;
    ```
  3. question figure
    text
    ```sql
    UPDATE Student SET Name = 'Kavya', Age = 20 WHERE ID = 109;
    ```
  4. question figure
    text
    ```sql
    SELECT Name, Courses from Student where Marks>60;
    ```
Q25MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

```python
from string import Template

statement = Template("the $var1 boxing $var2 jump $var3")

out = statement.substitute(var_dict)

print(out)
```

Which of the following options correctly represent(s) the dictionary `var_dict`, such that the code does not throw any error when run in the terminal?
  1. question figure
    text
    ```python
    var_dict = {'var1': 'five', 'var2': 'wizards'}
    ```
  2. question figure
    text
    ```python
    var_dict = {'var1': 'five', 'var2': 'wizards', 'var3': 'quickly'}
    ```
  3. question figure
    text
    ```python
    var_dict = { 'var1': 'five', 'var2': 'wizards', 'var3': 'quickly',
    'var4': 'away' }
    ```
  4. question figure
    text
    None of these
Q26MSQ4.5 marksselect all that apply
An HTML code is given below then which of the following CSS code will render the output as shown below. question figure An HTML code is given below then which of the following CSS code will render the output as shown below.
Text of the picture (copyable)
HTML Code:

```html
<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <link href="style.css" rel="stylesheet">
    <style>
        body{background-color:lightgray !important; text-align: center;}
        h2{color: purple !important ;}
    </style>
</head>
<body style="background-color:lavender;" >
    <h2 style="color: blue;">CSS Selectors</h2>
    <p class="one">ID</p>
    <p class="two" >Class</p>
    <p class="three" id="id">Element</p>
</body>
</html>
```

Rendered Output:
A screenshot of a web page rendering. The background color is light gray. The text "CSS Selectors" is displayed in purple, centered. Below it, the text "ID" is displayed in yellow, centered. Below that, the text "Class" is displayed in red, centered. Below that, the text "Element" is displayed in blue, centered.
  1. question figure
    text
    ```css
    body{background-color: skyblue !important;}
    #id{color: blue ;}
    .one{color: yellow;}
    .two{color: red;}
    .three{color: green;}
    ```
  2. question figure
    text
    ```css
    body{background-color: skyblue ;}
    #id{color: red ;}
    .one{color: yellow;}
    .two{color: blue;}
    .three{color: green;}
    ```
  3. question figure
    text
    ```css
    body{background-color: skyblue !important;}
    #id{color: red ;}
    .one{color: blue;}
    .two{color: yellow;}
    .three{color: green;}
    ```
  4. question figure
    text
    ```css
    body{background-color: skyblue ;}
    #id{color: blue ;}
    .one{color: yellow;}
    .two{color: red;}
    ```
Q27MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following python code snippet and choose the correct option.

```python
def modify(func):
    def wrapper(x):
        list = func(x, [])
        return list
    return wrapper

@modify
def expandList(x, list = []):
    list.append(x)
    return list

print(expandList(5))
print(expandList(6))
```
  1. question figure
    text
    If `@modify` is commented and the updated code is run on the terminal, the output will be;
    ```
    [5]
    [6]
    ```
  2. question figure
    text
    If @modify is commented and the updated code is run on the terminal, the output will be;
    
    ```
    [5]
    [5, 6]
    ```
  3. question figure
    text
    If the code is run on the terminal directly, the output on the terminal will be;
    [5]
    [6]
  4. question figure
    text
    If the code is run on the terminal directly, the output on the terminal will be;
    ```
    [5]
    [5, 6]
    ```
Q28MSQ4.5 marksselect all that apply
Consider the following flask application. question figure Consider the following flask application.
Text of the picture (copyable)
```python
from flask import Flask, abort
app = Flask(__name__)
modules = ['python', 'react', 'node']

@app.route('/home/modules/')
def all_modules():
    return f"<h3>List of modules: {modules}</h3>"

@app.route('/get/<string:module_1>')
def get_module(module_1):
    if module_1 in modules:
        return f"<h3>One module found: {module_1}.</h3>"
    else:
        abort(400)

@app.errorhandler(400)
def module_error(error):
    return "<h3>Cannot find module</h3>"

@app.errorhandler(404)
def module_error(error):
    return "<h3>Incorrect Path</h3>"

app.run(debug=True)
```

If the application is running locally on http://127.0.0.1:5000, select the correct statement(s).
  1. question figure
    text
    For the URL, http://127.0.0.1:5000/home/modules, the browser will render:
    List of modules: ['python', 'react', 'node']
  2. question figure
    text
    For the URL, http://127.0.0.1:5000/home/modules, the browser will render:
    **Incorrect Path**
  3. question figure
    text
    For the URL, http://127.0.0.1:5000/get/react/, the browser will render:
    One module found: react.
  4. question figure
    text
    For the URL, http://127.0.0.1:5000/get/vuejs, the browser will render;
    Cannot find module
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q29MCQ2 marks
Which part of the response indicates the MIME type of the response body?
  1. charset=utf-8
  2. server: gunicorn/19.9.0
  3. content-type: text/html;
  4. None of these
Q30MCQ2 marks
Which part of the response indicates that the request created a successful response?
  1. server: gunicorn/19.9.0
  2. content-type: text/html;
  3. HTTP/2 200
  4. None of these
Comprehension passage - the questions below it refer to this
A machine client M makes multiple requests to three different servers A, B and C in the order A then B followed by C. However, it can make a request to server B only after receiving the response from server A and same with server C i.e. the client can make a request to server C only after receiving response from server B. If the servers A, B and C are located at 900 kms, 1200 kms and 1500 kms respectively, answer the given subquestions.[Consider speed of light in air to be 3 x 108 m/s]
Q31MCQ3 marks
What is the maximum number of requests that can be made to A per second?
  1. 166
  2. 42
  3. 56
  4. 111
Q32MCQ3 marks
What is the round trip time (RTT) in milliseconds for server C?
  1. 24
  2. 12
  3. 10
  4. 5

Answer key

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

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 essential for the "Modern Application Development I" exam, along with Mermaid knowledge graphs to visualize relationships.



1. Core Topics & Concepts

A. Web Development Fundamentals

1. URL Structure

2. HTML & CSS Rendering

3. HTTP & APIs

4. Flask (Python Web Framework)

5. Testing (Pytest)

6. Databases (SQLite, SQLAlchemy)

7. Git

8. WebAssembly & Emscripten

9. Networking Basics

10. Web Components


B. Software Engineering Principles

1. Code Coverage

2. Decorators (Python)

@modify def add(x): return x ```

3. Jinja2 Templating


C. Mathematics (Networking)

1. Round-Trip Time (RTT)

2. Request Rate



2. Key Equations (Mathematics/Networking)

ConceptEquation
Round-Trip TimeRTT (s) = (Distance × 2) / Speed of Light
Requests per SecondMax Requests/s = 1 / RTT
IPv4 to HexSplit into octets, convert each to hex (e.g., 171 → AB, 216 → D8).


Graph 2: Database & ORM

Graph 3: Networking & Git

Graph 4: Testing & Coverage

Graph 5: Flask Workflow



4. Exam Tips

  1. URL Breakdown: Always identify protocol, domain, subdomain, path, and query parameters.
  2. CSS Specificity: Inline > ID > Class > Element. !important overrides all.
  3. Flask Routes:

    • Dynamic routes: @app.route('/user/<username>').
    • Query parameters: request.args.get('key').
  4. Testing:

    • 100% statement coverage ≠ 100% branch coverage.
    • Use pytest -m marker to run specific tests.
  5. Database Relationships:

    • One-to-Many: Foreign key in the "many" table.
    • Many-to-Many: Junction table with two foreign keys.
  6. Networking:

    • RTT = (Distance × 2) / Speed of Light.
    • Convert distance to meters (1 km = 1000 m).
  7. Git:

    • git rm --cached removes from staging but keeps the file.
    • git rm deletes the file entirely.
  8. Jinja2:

    • groupby('key') groups items by a key.
    • {% for %} loops, {% if %} conditionals.
  9. WebAssembly: Emscripten compiles C/C++ to WASM.
  10. HTTP Headers:

    • Content-Type indicates MIME type.
    • 200 means success.