MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M FOUNDATION DIPLOMA AN EXAM QDF3 28 Apr 2024 - 28 Apr 2024

MAD1 End Term32 questions100 marks25 MCQ · 7 MSQFoundation / Diploma / afternoon / QDF3
Elapsed 00:00
Q1MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

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

var = sys.argv[0]

data = {"var1": "Data scientist", "var2": "programming",
        "var3": "statistical", "var4": "insights"}

temp = "{{var1}} creates $var2 code with $var3 knowledge to create {{var4}}."

if var == "1":
    temp = makeTemplate(temp)
    output = temp.substitute(data)
    print(output)

else:
    temp = Template(temp)
    output = temp.render(data)
    print(output)
```

What will be printed on the terminal for the command `python app.py 1 2`?
  1. question figure
    text
    ```
    {{var1}} creates programming code with statistical knowledge to
    create {{var4}}.
    ```
  2. question figure
    text
    ```
    {{var1}} creates $var2 code with $var3 knowledge to create {{var4}}
    ```
  3. question figure
    text
    Data scientist creates programming code with statistical knowledge to create insights.
  4. question figure
    text
    Data scientist creates $var2 code with $var3 knowledge to create insights.
Q2MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following flask application running locally on `http://127.0.0.1:5000`?

```python
from flask import Flask

app = Flask(__name__)

@app.route('/home/<string:url>')
def get_url_str(url):
    return "string " +url

@app.route('/home/<path:url>')
def get_url_pth(url):
    return "path " +url

app.run(debug = True)
```

Which of the following URLs will throw a 404 Not Found error?
  1. question figure
    text
    http://127.0.0.1:5000/home/modules
  2. question figure
    text
    ```
    http://127.0.0.1:5000/modules/chapters/one
    ```
  3. question figure
    text
    ```
    http://127.0.0.1:5000/home/library/modules/chapters/one
    ```
  4. question figure
    text
    None
Q3MCQ2 marks
question figure
Text of the picture (copyable)
Consider the following view function.

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

@app.route('/student', methods = ['GET', 'POST'])
def show_details():
    cred = request.args
    details = {
        'Stream': cred['dept'],
        'Roll': cred['roll'],
        'Course': cred['course']
    }
    return details

app.run()
```

If this flask app is running locally on http://127.0.0.1:5000, which of the following URLs will be handled by the controller correctly?
  1. http://127.0.0.1:5000?dept=data_science&roll=cs1001&course=cs2003
  2. http://127.0.0.1:5000/student?dept=data_science&roll=cs1001&course=cs2003
  3. http://127.0.0.1:5000/data_science/cs1001/cs2003
  4. http://127.0.0.1:5000/student/data_science/cs1001/cs2003
Q4MCQ2 marks
Which of the following is not a frontend framework?
  1. Vue JS
  2. React JS
  3. Node JS
  4. Angular JS
Q5MCQ2 marks
Consider the following statements and select the correct option: Statement 1: In a database, an index can only be created on one column of a table. Statement 2: Indexes cannot be created on columns which have duplicate values.
  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
question figure
Text of the picture (copyable)
Match the type of service approaches from column A to their correct examples in column B.

| | Column A | | Column B |
|---|---|---|---|
| a | SaaS | 1 | Replit |
| b | PaaS | 2 | Office 365 |
| c | IaaS | 3 | Amazon Web Services |
  1. a-2, b-3, c-1
  2. a-2, b-1, c-3
  3. a-1, b-2, c-3
  4. a-1, b-3, c-2
Q7MCQ3 marks
question figure
Text of the picture (copyable)
In the code snippet given below, what should come in place of code 1 and code 2 such that one book can have multiple sections and the converse does not hold true?

```python
from sqlalchemy import ForeignKey
from sqlalchemy import Integer, Column
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import relationship

class Base(DeclarativeBase):
    Pass

class Section(Base):
    __tablename__ = "section_table"
    id = Column(Integer, primary_key=True)
    # write your code 1 here

class Book(Base):
    __tablename__ = "book_table"
    id = Column(Integer, primary_key=True)
    # write your code 2 here
```
  1. question figure
    text
    ```python
    code 1: book_id=Column(Integer, ForeignKey("book_table.id"))
    code 2: books = relationship("Section")
    ```
  2. question figure
    text
    ```python
    code 1: books = relationship("Section")
    code 2: section_id=Column(Integer, ForeignKey("book_table.id"))
    ```
  3. question figure
    text
    ```
    code 1: book_id=Column(Integer, ForeignKey("book_table.id"))
    code 2: sections = relationship("Book")
    ```
  4. question figure
    text
    ```python
    code 1: books = relationship("Book")
    code 2: section_id=Column(Integer, ForeignKey("section_table.id"))
    ```
Q8MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following flask app and Jinja2 template.
app.py

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

@app.route('/')
def index():
    return render_template("index.html", data=['Harry', 'Karl', 'John',
                                                'Jason', 'Ros'])

app.run()
```

index.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Macro</title>
</head>
<body>
    {% macro unordered_list(items)%}
    <ul>
        {% for item in items %}
        {% if item|length >= 5 %}
        <li>{{item}}</li>
        {% endif %}
        {% endfor %}
    </ul>
    {% endmacro %}
    {{ unordered_list(data) }}
</body>
</html>
```

If the flask app is running locally on http://127.0.0.1:5000. What will be the output on the browser for the base URL?
  1. question figure
    text
    - Harry
    - Karl
    - John
    - Jason
    - Ros
  2. question figure
    text
    - Karl
    - John
  3. question figure
    text
    - Harry
    - Jason
  4. question figure
    text
    - Karl
    - John
    - Ros
Q9MCQ3 marks
question figure
Text of the picture (copyable)
Match the following types of testing with their functionality.

| | |
|---|---|
| A. Regression testing | 1. Beta Testing |
| B. User Acceptance testing | 2. Considers internal functioning of the system |
| C. White Box Testing | 3. Simulates actual user interaction, allows to script browser |
| D. System testing Automation | 4. Type of testing that runs after every change to ensure that the change introduces no unintended breaks. |

Which of the following is the correct matching?
  1. question figure
    text
    A → 1, B → 2, C → 3, D → 4
  2. question figure
    text
    A -> 4, B -> 3, C -> 2, D -> 1
  3. question figure
    text
    A → 4, B → 1, C → 2, D → 3
  4. question figure
    text
    A → 3, B → 2, C → 1, D → 4
Q10MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following flask application.

```python
from flask import Flask, render_template, request
app = Flask(__name__)

@app.route('/')
def square():
    val = request.args

    if val['num'] == '':
        return "<h1>Enter a valid number</h1>"
    elif val['num'].isalpha()==True:
        return "<h1>Invalid number</h1>"
    else:
        out = (int(val['num'])) * (val['num'])
        return f'<h1>{out}</h1>'

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

If this flask app is running locally on http://localhost:5000, what is the output for the URL
http://localhost:5000/?num=4 ?
  1. 4
  2. 44
  3. ValueError
  4. 4444
Q11MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.
log.py

```python
import logging
import sys

logging.basicConfig(level=logging.WARNING,
                    format='%(asctime)s - %(levelname)s - %(message)s')

def check_val(value):
    if value < 0:
        raise ValueError("Invalid value: Please enter a positive value.")
    else:
        logging.info("Value added: %s", value)

try:
    input_value = -int(sys.argv[1])
    check_val(input_value)
except ValueError as ve:
    logging.exception("Exception occurred: %s", str(ve))
```

What will be the output on the terminal for the command: `python log.py -12`?
  1. question figure
    text
    2023-08-14 21:01:05,684 - INFO - Value added: 12
  2. question figure
    text
    ```
    2023-08-14 21:01:05,684 - WARNING - Value added: -12
    ```
  3. question figure
    text
    Error: Exception occurred: Invalid value: Please enter a positive value.
  4. question figure
    text
    None.
Q12MCQ3 marks
The lens of an HDD can read data on the rotating disk with the speed of 42,000 bits per second. The disk is designed such that 600 bits pass under the lens for every revolution of the disk, what should be the maximum speed of disk in RPM so that the lens does not miss any data?
  1. 70 RPM
  2. 100 RPM
  3. 4200 RPM
  4. 6000 RPM
Q13MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following python code snippet.

```python
from string import Template

statement = "The $animal jumped over the $obstacle."

temp = Template(statement)

print(=== OUTPUT ===)
```

Which of the following statements, when substituted in place of === OUTPUT ===, will throw a KeyError?
  1. question figure
    text
    ```python
    temp.substitute({"animal": "cat"})
    ```
  2. question figure
    text
    ```python
    temp.safe_substitute({"animal": "dog", "obstacle": "fence"})
    ```
  3. question figure
    text
    ```python
    temp.safe_substitute({"animal": "rabbit"})
    ```
  4. question figure
    text
    ```python
    temp.safe_substitute({"obstacle": "wall", "place": "park town"})
    ```
Q14MCQ3 marks
question figure
Text of the picture (copyable)
What will be the output of the following Python code?

```python
from jinja2 import Template
my_statement = Template("The special series is:{% for n in
range(1,15)%} {{n//3}}" "{% endfor %}")
out = my_statement.render()
print(out)
```
  1. The special series is: 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4
  2. The special series is: 1 2 0 1 2 0 1 2 0 1 2 0 1 2
  3. The special series is: 0 0 1 1 1 2 2 2 3 3 3 4 4 4
  4. The special series is: 0.33 0.67 1.0 1.33 1.67 2.0 2.33 2.67 3.0 3.33 3.67 4.0 4.334.67
Q15MCQ3 marks
question figure
Text of the picture (copyable)
Consider that there are two HTML files.
i) index.html - Home page of the application
ii) login.html - Login page of the application
Which of the following code will navigate the user between **index.html** and **login.html**, and vice versa?
  1. question figure
    text
    ```html
    <!-- index.html contains-->
    <a src="index.html">Signin</a>
    
    <!-- login.html contains -->
    <a src="login.html">Home</a>
    ```
  2. question figure
    text
    ```html
    <!-- index.html contains ->
    <a href="index.html">Signin</a>
    
    <!-- login.html contains ->
    <a href="login.html">Home</a>
    ```
  3. question figure
    text
    ```html
    <!-- index.html contains ->
    <a src="login.html">Signin</a>
    
    <!-- login.html contains ->
    <a src="index.html">Home</a>
    ```
  4. question figure
    text
    ```html
    <!-- index.html contains ->
    <a href="login.html">Signin</a>
    
    <!-- login.html contains ->
    <a href="index.html">Home</a>
    ```
Q16MCQ3 marks
In an OpenAPI documentation, which field contains all the endpoints (routes) of the API?
  1. paths
  2. schema
  3. info
  4. responses
Q17MCQ3 marks
question figure
Text of the picture (copyable)
Consider the below two data models Author and Book using SQLite database.

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

class Book(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    title = db.Column(db.String())
    publisher = db.Column(db.String())
    written_by = db.Column(db.Integer(), db.foreign_key("author.id"),unique=True)
```

What kind of relationship exists between Author and Book classes?
  1. One Book to one Author relationship
  2. One Author to many Books relationship
  3. Many Authors to one Book relationship
  4. Many Books to many Author relationship
Q18MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider a function func, and a set of test cases given below.
Filename: test_file.py

```python
import pytest
def func(x,y):
    out = x**2+y**2
    return out

class Test_class0():
    def test_case1(self):
        assert func(1,2) == 5

    def case_test2(self):
        assert func(2,3) == 13

    def case_test3(self):
        assert func(6,2) == 38

class Test_class1():
    def test_case1(self):
        assert func(5,2) == 29

    def case_test2(self):
        assert func(1,1) == 2
```

What will be the output on the terminal for the command below?
pytest test_file.py -k Test_class
  1. question figure
    text
    ```
    == 1 failed, 4 passed in 0.17s ===
    ```
  2. question figure
    text
    ```
    == 2 passed, 3 deselected in 0.17s ===
    ```
  3. question figure
    text
    ```
    == 2 passed in 0.07s ===
    ```
  4. question figure
    text
    ```
    == 3 failed, 2 passed in 0.17s ===
    ```
Q19MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following python code snippet app.py, the html files, base.html and home.html residing in "templates" folder.
app.py

```python
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
    return render_template('home.html')

app.run(debug=True)
```

home.html

```html
{% extends "base.html" %}
{% block content %}
<p>MAD I</p>
<span>MAD II</span>
<p>DBMS</p>
{% endblock %}
```

base.html

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>IITM</title>
</head>
<body>
    <h2 style="color: violet;"> Diploma Courses </h2>
    {% block content %}
    {% endblock %}
</body>
</html>
```

What will be the rendered output for base URL if flask app is running locally on
http://localhost:5000 ?
  1. question figure
    text
    MAD I
    MAD II
    DBMS
  2. question figure
    text
    Diploma Courses
    
    MAD I
    
    MAD II
    
    DBMS
  3. question figure
    text
    Diploma Courses
    
    MAD I
    
    MAD II DBMS
  4. question figure
    text
    MAD I
    MAD II DBMS
Q20MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the below Flask Restful API code snippet:
**app.py**

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

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

data_info = [
    {"name": "IITM", "mail": "abc@study.iitm.ac.in"}
]

class Data(Resource):
    def get(self):
        return data_info

    def post(self):
        name = request.json["name"]
        mail = request.json["mail"]
        data = {}
        data["name"] = name
        data["mail"] = mail
        data_info.append(data)
        return "Saved data", 200

api.add_resource(Data, "/")
if __name__ == "__main__":
    app.run()
```

Assume that above **app.py** is running on http://127.0.0.1:5000/. What will be the outputs of the below sequence of CURL commands:
i)

```
curl -X POST -H "Content-Type: application/json" -H "Accept-Type: application/json" -d "{\"name\":\"Javed\",\"mail\":\"javed@study.iitm.ac.in\"}" "http://127.0.0.1:5000/"
```

ii)

```
curl -X GET "http://127.0.0.1:5000"
```
  1. question figure
    text
    i) "Saved data"
    ii)
    ```
    [
        {
            "name": "IITM",
            "mail": "abc@study.iitm.ac.in"
        },
        {
            "name": "Javed",
            "mail": "javed@study.iitm.ac.in"
        }
    ]
    ```
  2. question figure
    text
    i)
    ```json
    [
        {
            "name": "IITM",
            "mail": "abc@study.iitm.ac.in"
        },
        {
            "name": "Javed",
            "mail": "javed@study.iitm.ac.in"
        }
    ]
    ```
    ii) "Saved data"
  3. question figure
    text
    i)
    ```
    [
        {
            "name": "Javed",
            "mail": "javed@study.iitm.ac.in"
        }
    ]
    ```
    ii)
    ```
    [
        {
            "name": "IITM",
            "mail": "abc@study.iitm.ac.in"
        }
    ]
    ```
  4. question figure
    text
    i)
    ```
    [
        {
            "name": "IITM",
            "mail": "abc@study.iitm.ac.in"
        }
    ]
    ```
    ii)
    ```
    [
        {
            "name": "Javed",
            "mail": "javed@study.iitm.ac.in"
        }
    ]
    ```
Q21MCQ4.5 marks
Consider the following graph that represents the variation in bandwidth of a network for an entire day (24 hours). Three users were connected to the network at three different times of the day. What is the total data consumed in GigaBytes by all the users in 24 hrs? question figure Consider the following graph that represents the variation in bandwidth of a network for an entire day (24 hours). Three users were connected to the network at three different times of the day. What is the total data consumed in GigaBytes by all the users in 24 hrs?
Text of the picture (copyable)
This is a 2D line graph with a horizontal x-axis labeled "Time (Hours)" and a vertical y-axis labeled "BandWidth Megabits/s".

The x-axis ranges from 0 to 24, with major tick marks at 0, 4, 8, 12, 14, 16, 20, and 24.
The y-axis ranges from 0 to 12, with major tick marks at 0, 2, 4, 6, 8, 10.

There is an orange step-function line plotted on the graph.
- From Time 0 to 4, BandWidth is 8 Megabits/s.
- From Time 4 to 8, BandWidth is 10 Megabits/s.
- From Time 8 to 12, BandWidth is 6 Megabits/s.
- From Time 12 to 16, BandWidth is 8 Megabits/s.
- From Time 16 to 20, BandWidth is 2 Megabits/s.
- From Time 20 to 24, BandWidth is 10 Megabits/s.

Three horizontal colored lines are drawn above the step function, each labeled with a user.
- A blue line labeled "user 1" extends from Time 0 to Time 4.
- A yellow line labeled "user 2" extends from Time 8 to Time 14.
- A green line labeled "user 3" extends from Time 16 to Time 24.

Vertical dashed lines extend from the x-axis tick marks at 4, 8, 12, 14, 16, 20, and 24 up to the top of the graph.
  1. 633.6 GB
  2. 54 GB
  3. 120 GB
  4. 432GB
Q22MCQ4.5 marks
question figure
Text of the picture (copyable)
An HTML code and CSS code is given below. Which of the following correctly represents
its rendered output?
CSS Code:

```css
#one{color: blue;}
.two{color: red !important;}
#two{color: green}
#three{color: green;}
```

HTML Code:

```html
<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <link href="style.css" rel="stylesheet">
    <style>
        body{font-weight: bold;}
        p{color: violet !important ;}
    </style>
</head>
<body>
    <span id="one">Content 1</span>
    <p class="two" id="two">Content 2</p>
    <span id="three">Content 3</span>
</body>
</html>
```
  1. question figure
    text
    Content 1 Content 2
    Content 3
  2. question figure
    text
    Content 1
    Content 2
    Content 3
  3. question figure
    text
    Content 1 Content 2
    Content 3
  4. question figure
    text
    Content 1
    Content 2
    Content 3
Q23MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the below two python files code snippets app.py and test_app_route.py.
app.py

```python
from flask import Flask
app = Flask(__name__)

@app.route("/greet/<string:name>")
def home(name):
    return "Hello, " + name

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

test_app_route.py:

```python
import pytest, requests

@pytest.fixture
def get_response():
    resp = requests.get("http://127.0.0.1:5000/greet/IITM")
    return resp

def test_response(get_response):
    assert get_response.text == "Hello, IITM"
```

Assume that app.py and test_app_route.py are running on two different terminals. And also all required modules are installed. Which of the below statement(s) are True?

i) Executing the command `pytest test_app_route.py` on the terminal returns
============ 1 passed ============

ii) Executing the command `pytest test_app_route.py` on the terminal returns
============ 1 failed ============

iii) Executing the command `pytest test_app_route.py` on the terminal returns
============ 1 selected, 1 passed ============

iv) Executing the command `pytest test_app_route.py` on the terminal returns
============ 1 deselected ============
  1. Only statement i is correct
  2. Only statement ii is correct
  3. Statements i and iii are correct
  4. Statements ii and iv are correct
Q24MSQ2 marksselect all that apply
Which of the following is true about the term “stateful” in the client-server model?
  1. The server responds to the client based on the previous state.
  2. The server uses FTP protocol to respond to the client's request.
  3. Network performance may reduce because of the large amount of data sentout repetitively.
  4. Server is not required to maintain any state of client or session duringtransactions between client and server.
Q25MSQ2 marksselect all that apply
question figure
Text of the picture (copyable)
What can be inferred from the Entity-Relationship Diagram below:

The image displays an Entity-Relationship Diagram (ERD) with two entities: "Salary_Slip" and "Employee".

**Entity: Salary_Slip**
*   **Attributes:**
    *   slip_id (PK)
    *   Year (DateTime)
    *   Month (DateTime)
    *   Salary_issued (Boolean)
    *   Total_salary (Integer)

**Entity: Employee**
*   **Attributes:**
    *   Employee_id (PK)
    *   Employee_name (Text)

**Relationship:**
There is a relationship line connecting "Salary_Slip" and "Employee".
*   The "Salary_Slip" side of the relationship has a crow's foot symbol with a single line, indicating "many".
*   The "Employee" side of the relationship has two vertical lines, indicating "exactly one".
This represents a "many-to-one" relationship where many Salary_Slips can be associated with exactly one Employee.
  1. An employee can exist without having any salary slips
  2. A salary slip can exist without belonging to any employee
  3. An employee needs to have at least one salary slip
  4. A salary slip must belong to one and only one employee
Q26MSQ2 marksselect all that apply
What is the name of the branch that we start with when we create a new git repository?
  1. main
  2. master
  3. develop
  4. feature
Q27MSQ3 marksselect all that apply
Which of the statements are true?
  1. HTML5 is based on SGML
  2. XHTML is based on XML which in turn is based on SGML
  3. HTML5 is not backwards compatible with older versions of HTML
  4. XML is both human and machine readable
Q28MSQ3 marksselect all that apply
Consider a client ‘C’ and a server ‘S’, separated by distance ‘D’ are connected by a fictitious medium in which the speed of light is ‘v’ m/sec. If ‘N’ is the number of consecutive requests that can made in a second by the client ‘C’ (i.e A new request can be made only after receiving the response from the previous request.), Which of the following changes would halve the number ‘N’?
  1. A change of medium where the speed of light is v/2 m/sec.
  2. A change of medium where the speed of light is 2v m/sec.
  3. Reduce the distance between C and S from D to D/2.
  4. Increase the distance between C and S from D to 2D.
Q29MSQ4.5 marksselect all that apply
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/are correct?

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

@app.route('/library')
def home():
    return 'Select your course!'

@app.route('/student/<username>/<roll>')
def dashboard(username):
    return f'{username}\'s dashboard'

with app.test_request_context():
    #== print statement ==#
```
  1. question figure
    text
    If `#== print statement ==#` is replaced by:
    ```python
    print(url_for('home', user = "mad1_cs2003"))
    ```
    the output on the terminal will be;
    `/library/mad1_cs2003.`
  2. question figure
    text
    If `#== print statement ==#` is replaced by:
    ```python
    print(url_for('home', user = "mad1_cs2003")),
    ```
    the output on the terminal will be;
    `/library?user=mad1_cs2003.`
  3. question figure
    text
    If #== *print statement* ===# is replaced by:
    ```python
    print(url_for('dashboard', username = "mad1", roll = "cs2003", term = "jan2024"))
    ```
    the output on the terminal will be:
    `/student/mad1/cs2003/jan2024.`
  4. question figure
    text
    If #== *print statement* ==# is replaced by:
    ```python
    print(url_for('dashboard', username = "mad1", roll = "cs2003", term = "jan2024")),
    ```
    the output on the terminal will be:
    `/student/mad1/cs2003?term=jan2024.`
Q30MSQ4.5 marksselect all that apply
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
import pytest

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

@pytest.mark.marker1
def testcase_1():
    assert square(10) == 100

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

@pytest.mark.marker3
def testcase_3():
    assert square(5) == 25

@pytest.mark.marker4
def testcase_4():
    assert square(6) == 6
```
On running this file on the terminal using pytest, the summary of the output is;

`========= 1 passed, 3 deselected, 4 warnings in 0.04s =========`

What command will result into the outcome given above?
  1. question figure
    text
    ```
    pytest test_file.py -m marker4
    ```
  2. question figure
    text
    ```
    pytest test_file.py -m marker1
    ```
  3. question figure
    text
    ```
    pytest test_file.py -m marker2
    ```
  4. question figure
    text
    ```
    pytest test_file.py -m marker3
    ```
Comprehension passage - the questions below it refer to this
Based on the above data, answer the given subquestions. question figure
Q31MCQ3 marks
question figure
Text of the picture (copyable)
What will be output on the terminal
for the command
`python file.py course 4?`
  1. question figure
    text
    ```
    course found App Dev I
    course found App Dev II
    course found App Dev III
    course found DevOps
    ```
  2. question figure
    text
    ```
    course found App Dev I
    course found App Dev II
    course found App Dev III
    ```
  3. question figure
    text
    No course found!
  4. question figure
    text
    ```
    IndexError: list index out of range
    ```
Q32MCQ3 marks
question figure
Text of the picture (copyable)
What will be output on the terminal
for the command

```
python file.py course 1?
```
  1. question figure
    text
    No course found!
  2. question figure
    text
    ```
    course found App Dev I
    ```
  3. question figure
    text
    ```
    course found App Dev I
    course found App Dev II
    course found App Dev III
    course found Dev0ps
    ```
  4. question figure
    text
    ```
    IndexError: list index out of range
    ```

Answer key

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

Concepts this paper tests

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

Here’s a structured summary of the core topics, concepts, principles, and equations essential for the "Modern Application Development I" exam, along with Mermaid knowledge graphs to visualize relationships.


Core Topics & Concepts Summary

1. Python & Templating Engines

Key Concepts:

Example Code Snippets:

### String Template
from string import Template
temp = Template("Hello, $name!")
print(temp.substitute(name="Alice"))  # Output: Hello, Alice!

### Jinja2 Template
from jinja2 import Template
temp = Template("Hello, {{name}}!")
print(temp.render(name="Bob"))  # Output: Hello, Bob!

Key Equations/Logic:


2. Flask (Web Framework)

Key Concepts:

Example Code Snippets:

### Basic Route
@app.route('/user/<username>')
def show_user(username):
    return f"User: {username}"

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

### POST Request
@app.route('/data', methods=['POST'])
def add_data():
    data = request.json
    return {"status": "success", "data": data}

Key Equations/Logic:


3. Frontend Technologies

Key Concepts:

Example Code Snippets:

<!-- Correct Navigation -->
<a href="login.html">Login</a>

<!-- CSS Specificity -->
<style>
  #header { color: red; }          /* ID (high priority) */
  .text { color: blue; }            /* Class */
  p { color: green; }               /* Tag (low priority) */
  p { color: yellow !important; }   /* Overrides all */
</style>

4. Databases & SQLAlchemy

Key Concepts:

Example Code Snippets:

### One-to-Many (Book → Sections)
class Book(Base):
    __tablename__ = "books"
    id = Column(Integer, primary_key=True)
    sections = relationship("Section", back_populates="book")

class Section(Base):
    __tablename__ = "sections"
    id = Column(Integer, primary_key=True)
    book_id = Column(Integer, ForeignKey("books.id"))
    book = relationship("Book", back_populates="sections")

Key Equations/Logic:


5. Testing (Pytest)

Key Concepts:

Example Code Snippets:

### Pytest Example
def test_add():
    assert add(2, 3) == 5

@pytest.mark.slow
def test_long_running():
    assert heavy_computation() == 42

Run specific tests:

pytest -m "slow"  # Runs only @pytest.mark.slow tests

6. Cloud Computing (SaaS, PaaS, IaaS)

TypeExampleDescription
SaaSOffice 365, GmailSoftware as a service (user-facing).
PaaSReplit, HerokuPlatform for developers (no infra management).
IaaSAWS, AzureInfrastructure (VMs, storage, networking).

7. Git & Version Control

Key Concepts:


8. Networking & Performance

Key Concepts:

Key Equations:


9. HTML/XML

Key Concepts:


10. Client-Server Model

Key Concepts:


11. OpenAPI/Swagger



2. Flask Routing & HTTP Methods

3. Database Relationships (SQLAlchemy)

4. Frontend Technologies

5. Testing (Pytest)

6. Cloud Services (SaaS/PaaS/IaaS)

7. Git Workflow

8. Networking & Performance