MAD Study Hub

Home / Past papers / MAD1 End Term / this paper

IIT M DIPLOMA FN1 EXAM ETD1 11 Dec 2022 - 11 Dec 2022

MAD1 End Term32 questions100 marks23 MCQ · 8 MSQ · 1 SADiploma
Elapsed 00:00
Q1MCQ3 marks
Consider the URL given below. http://appdev1.com/sep-22?week=2#MVC Which of the following options correctly describes each component of the URL given above? question figure Consider the URL given below. http://appdev1.com/sep-22?week=2#MVC Which of the following options correctly describes each component of the URL given above?
Text of the picture (copyable)
| URL Component | Name          |
| :------------ | :------------ |
| 1. http       | A. Domain Name |
| 2. appdev1.com | B. Query String |
| 3. /sep-22    | C. Protocol   |
| 4. ?week=2    | D. Fragment   |
| 5. #MVC       | E. Path       |
  1. 1-C, 2-A, 3-D, 4-B, 5-E
  2. 1-C, 2-A, 3-E, 4-B, 5-D
  3. 1-C, 2-A, 3-B, 4-D, 5-E
  4. 1-C, 2-A, 3-B, 4-E, 5-D
Q2MCQ3 marks
Consider the following flask python snippet with all preliminary conditions. question figure Consider the following flask python snippet with all preliminary conditions.
Text of the picture (copyable)
```python
class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key = True)
    name = db.Column(db.String(30))
    def __init__(self, id, name):
        self.id = id
        self.name = name
@login_manager.user_loader
def firstuser(id):
    return User.query.get(int(id))
@app.route('/')


def index():
    u1 = User.query.filter_by(id = 112).first()
    login_user(u1)
    return current_user.name + ' logged in'
@app.route('/logout')
@login_required
def logout():
    logout_user()
    return 'logged out'
@app.route('/home')
@login_required
def home():
    return "current user is " + current_user.name

def init_db():
    db.create_all()
    new_user = User(112, 'Rose')
    new_user2 = User(113, 'lily')
    db.session.add(new_user)
    db.session.add(new_user2)
    db.session.commit()
if __name__ == '__main__':
    init_db()
    app.run(debug = True)
```
If the above program is running in the URL “http://127.0.0.1:8000” then what will be the output for the given URLs in sequence.

* http://127.0.0.1:8000
* http://127.0.0.1:8000/home
* http://127.0.0.1:8000/logout
  1. current user is lilylogged outlily logged in
  2. current user is Roselogged outRose logged in
  3. Rose logged incurrent user is Roselogged out
  4. lily logged incurrent user is lilylogged out
Q3MCQ3 marks
Which of the following statements is true about the way of adding style in HTML documents?
  1. Order of precedence of external styles is greater than internal and inlinestyle attributes
  2. Order of precedence of internal styles is greater than inline and externalstyle attributes
  3. Order of precedence of Inline styles is greater than internal and externalstyle attributes
  4. None of these
Q4MCQ3 marks
Which of the following jinja template snippets correctly implements a for loop for creating a list of title links for an image?
  1. question figure
    text
    ```html
    <ul>
        {% for item in navigation %}
        <li>
            <a href="{{item.href}}">{{item.title}}</a>
        </li>
        {% endfor-navigation %}
    </ul>
    ```
  2. question figure
    text
    ```html
    <ul>
        {{ for item in navigation }}
        <li>
            <a href = "{%item.href%}">{%item.title%}</a>
        </li>
        {{ endfor }}
    </ul>
    ```
  3. question figure
    text
    ```html
    <ul>
        {% for item in navigation %}
        <li>
            <a href="{{item.href}}">{{item.title}}</a>
        </li>
        {% endfor %}
    </ul>
    ```
  4. question figure
    text
    ```html
    <ul>
        {% for item in navigation %}
        <li>
            <a href="{{item.href}}">{{item.title}}</a>
        </li>
        {% end %}
    </ul>
    ```
Q5MCQ3 marks
A template named userinfo.html contains the following line inside the body tag: question figure A template named userinfo.html contains the following line inside the body tag:
Text of the picture (copyable)
```html
<h1> Hello {{user_name}}! </h1>
```
Which of the following code snippets will utilize the template to display **Hello Ram** when **http://localhost:5000/user/Ram** is visited on the browser?
  1. question figure
    text
    ```python
    @app.route('/user/<name>')
    def user():
        return render_template('userinfo.html',user_name=name)
    ```
  2. question figure
    text
    ```python
    @app.route('/user/<name>')
    def user(name):
        return render_template('userinfo.html',user_name=name)
    ```
  3. question figure
    text
    ```python
    @app.route('/user/<user_name>')
    def user(name):
        return render_template('userinfo.html', user_name = name)
    ```
  4. question figure
    text
    ```python
    @app.route('/user/<name>')
    def user(name):
        return render_template('templates/userinfo',user_name=name)
    ```
Q6MCQ3 marks
Given the resource below, What is displayed when a user visits “http://localhost:5000/hello” on the browser? question figure Given the resource below, What is displayed when a user visits “http://localhost:5000/hello” on the browser?
Text of the picture (copyable)
```python
from flask_restful import Api
api = Api(app)
class Hello(Resource):
    def post(self):
        return {'User':'Abhishek'}
api.add_resource(Hello, '/hello')
```
  1. question figure
    text
    HTTP 404 - Page Not Found Error
  2. question figure
    text
    ```json
    {
        "Hello": "Abhishek"
    }
    ```
  3. question figure
    text
    Hello Abhishek
  4. question figure
    text
    ```json
    {
      "message": "The method is not allowed for the requested URL."
    }
    ```
Q7MCQ3 marks
A server, using the inbuilt http module of Python, is running for a directory My_app whose file structure and content of each file is given below. question figure A server, using the inbuilt http module of Python, is running for a directory My_app whose file structure and content of each file is given below.
Text of the picture (copyable)
Folder: My_app

My_app
|__home.html
|__index.html
|__main.html

File: home.html

```html
<h1>Hello from Home!</h1>
```

File: index.html

```html
<h1>Hello from Index!</h1>
```

File: main.html

```html
<h1>Hello from Main!</h1>
```

What will be rendered by the browser for the URL: http://localhost:8000 assuming that 8000 is the port of connection?
  1. question figure
    text
    Directory listing for /
    * home.html
    * index.html
    * main.html
  2. question figure
    text
    Hello from Home!
  3. question figure
    text
    Hello from Index!
  4. question figure
    text
    Hello from Main!
Q8MCQ3 marks
Match the following: question figure Match the following: Which of the following is the correct?
Text of the picture (copyable)
| | |
|---|---|
| A. API | 1. Servers do not assume anything about the client's state; they only serve responses. |
| B. MVC | 2. An action is assigned to each uniform resource locator. |
| C. Routing | 3. A standard way defined between two applications for them to communicate. |
| D. Stateless | 4. A design pattern that emphasizes the separation of concerns. |
  1. A-1, B-2, C-3, D-4
  2. A-2, B-4, C-1, D-3
  3. A-3, B-4, C-2, D-1
  4. A-4, B-3, C-1, D-2
Q9MCQ2 marks
Consider the following HTML page with javascript, which is running at the URL http://127.0.0.1:8000, then choose the correct HTML rendering. question figure Consider the following HTML page with javascript, which is running at the URL http://127.0.0.1:8000, then choose the correct HTML rendering.
Text of the picture (copyable)
```html
<!DOCTYPE html>
<html>
<body>

<h2>Creating a JSON String</h2>

<p id="demo"></p>

<script>
  const txt = '{"name":"Balu", "age":30, "city":"New Delhi"}'
  const obj = JSON.parse(txt);
  document.getElementById("demo").innerHTML = "Hi\n" + obj.name + ",\t" + obj.city + "," + obj.age*3;
</script>

</body>
</html>
```
  1. question figure
    text
    Creating a JSON String
    Hi Balu, New Delhi,30
  2. question figure
    text
    Creating a JSON String
    Hi Balu, 30, New Delhi
  3. question figure
    text
    Creating a JSON String
    
    Hi Balu, New Delhi,90
  4. question figure
    text
    Creating a JSON String
    Hi Balu, 90, New Delhi
Q10MCQ2 marks
If the given python program is executed using pytest, then identify the status of the test code. File name: test1.py question figure If the given python program is executed using pytest, then identify the status of the test code. File name: test1.py
Text of the picture (copyable)
```python
def dec(x):
    return x-1

def test_answer():
    assert dec(3) == 3
```
  1. passed test1.py test_answer - assert 2 == 3
  2. 2 Failed
  3. 1 passed
  4. Failed test1.py test_answer - assert 2 == 3
Q11MCQ2 marks
Which of the following lines can be used in a template to inherit another base.html template that provides a basic, uniform layout?
  1. {% expand 'base.html'%}
  2. {% include 'base.html'%}
  3. {% extends 'base.html'%}
  4. {% inherits 'base.html %}
Q12MCQ2 marks
Which of the following routes binds the index() function to the application's root URL and renders the index.html template?
  1. question figure
    text
    ```python
    @app.route('/')
    def index():
        return render_template('index')
    ```
  2. question figure
    text
    ```python
    @app.route('/')
    def index():
        return render_template('index.html')
    ```
  3. question figure
    text
    ```python
    @app.route('/')
    def index():
        return render_template(index.html)
    ```
  4. question figure
    text
    ```python
    @app.route('index.html')
    def index():
        return render_template('/')
    ```
Q13MCQ2 marks
In the given HTML template, to correctly embed a URL in the href, the argument "user" in the "url_for" function must be a __________________? question figure In the given HTML template, to correctly embed a URL in the href, the argument "user" in the "url_for" function must be a __________________?
Text of the picture (copyable)
```html
<a href = {{ url_for('user')}}>Click here</a>
```
  1. A view function name
  2. An HTML template name
  3. A URL
  4. An environment variable
Q14MCQ2 marks
Read the following statements carefully and mark the correct answer: Statement 1: Continuous integration is the practice of automating the integration of code changes from multiple contributors into a single software project Statement 2: Continuous Delivery refers to automated delivery of “release package” on each successful test
  1. Statement 1 is correct, but statement 2 is incorrect.
  2. Statement 2 is correct, but statement 1 is incorrect.
  3. Both statements 1 and 2 are correct.
  4. Both statements 1 and 2 are incorrect.
Q15MCQ4.5 marks
Consider the following constraints for the “student” table: question figure Consider the following constraints for the “student” table:
Text of the picture (copyable)
| Column Name | Datatype | Constraints |
|---|---|---|
| RollNo | Integer | Primary Key |
| Name | String | Not Null |
| AadhaarNo | Integer | Not Null, UNIQUE |
| Department | String | Not Null |

In most cases, the query executed in the student table looks like the one below.

```sql
SELECT RollNo, Name, AadhaarNo FROM student WHERE Department = 'Biology';
```

For the above student table, which of the following columns would be the most appropriate for the indexing?
  1. RollNo
  2. Name
  3. AadhaarNo
  4. Department
Q16MSQ3 marksselect all that apply
Which of the following statement(s) is/are true regarding Git?
  1. question figure
    text
    Git is an example of a centralized version control system.
  2. question figure
    text
    A file can stay in both working directory and staging area at a given time, while working with Git.
  3. question figure
    text
    Git and GitLab/GitHub are essentially the same.
  4. question figure
    text
    The command "git checkout -b <branch_name>" will create the new branch and switches to the new branch created.
Q17MSQ3 marksselect all that apply
Which of the following statement(s) is/are false regarding database migrations?
  1. Flask does not provide support for migrations, as of December 2022.
  2. The database migration allows a developer to make schema changes withoutlosing the data.
  3. One of the disadvantages of migration is that a developer can only upgradethe database, and it does not allow rollbacks.
  4. The migration is useful when a business wants to move from an on-premisedatabase to a cloud based database.
Q18MSQ3 marksselect all that apply
Consider the following Model for User. question figure Consider the following Model for User.
Text of the picture (copyable)
```python
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(100), unique=True, index=True)
    name = db.Column(db.String(100))
    password = db.Column(db.String(100))
```
Which of the following methods from the Flask-sqlalchemy package will behave the same as SQL query `select * from User where name='Ram'`?
  1. question figure
    text
    ```python
    User.query.filter(User.name = 'Ram').all()
    ```
  2. question figure
    text
    ```python
    User.query.get(name = 'Ram').all()
    ```
  3. question figure
    text
    ```python
    User.query.filter_by('Ram').all()
    ```
  4. question figure
    text
    ```python
    User.query.filter_by(name = 'Ram').all()
    ```
Q19MSQ4.5 marksselect all that apply
Consider the following Python code snippet: question figure Consider the following Python code snippet:
Text of the picture (copyable)
Filename: module_0.py

```python
import sys

arguments = sys.argv

courses = {'MAD-1': '1002', 'MAD 2': '2003', 'BDM': '205', 'SysCom': '304'}

def operate():
    arg_1 = arguments[1]
    arg_2 = courses[arg_1]
    return f"The function output is: {len(arg_1 + arg_2)}"

print(operate())
```

The above file will yield the output as "The function output is: 9", for which of the following command line inputs?
  1. question figure
    text
    ```
    python module_0.py MAD-1
    ```
  2. question figure
    text
    ```
    python module_0.py MAD 2
    ```
  3. question figure
    text
    ```
    python module_0.py BDM
    ```
  4. question figure
    text
    ```
    python module_0.py SysCom
    ```
Q20MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider two software packages A and B spend exactly $T_A(N) = 2N^2 + 9$ and $T_B(N) = N^3$ milliseconds to process N data items. Analyze the software packages and select the correct statement(s).
  1. Software package A is faster than Software package B for inputs in the range N∈ [0,3]
  2. Software package B is faster than Software package A for inputs in the range N∈ [0,3]
  3. Time taken by both the software packages A and B is the same when N = 3.
  4. Software package B is faster than Software package A for all N > 3.
Q21MSQ4.5 marksselect all that apply
Consider the following Python code snippet. question figure Consider the following Python code snippet.
Text of the picture (copyable)
```python
from flask import Flask, abort, redirect, url_for, render_template
app = Flask(__name__)

data_science = ['ML-techniques', 'ML-foundations', 'ML-practices']
programming = ['Java', 'MAD-I', 'System-Commands', 'PDSA']

@app.route('/courses/<course>')
def find_course(course):
    if course in data_science:
        return f"<h2>Data Science course found, {course}!</h2>"
    elif course in programming:
        return f"<h2>Programming course found, {course}!</h2>"
    else:
        abort(401)

@app.errorhandler(401)
def page_not_found(error):
    return "<h2>No course found!</h2>"

app.run()
```
If the above application is running locally on URL: http://127.0.0.1:5000, select the correct statement(s).
  1. question figure
    text
    For the URL, "http://localhost:5000/courses/ML-techniques", the browser will render:
    **Programming course found, ML-techniques!**
  2. question figure
    text
    For the URL, "http://localhost:5000/courses/ML-practices", the browser will render:
    **Data Science course found, ML-practices!**
  3. question figure
    text
    For the URL, "http://localhost:5000/courses/MAD-2", the browser will render:
    **No course found!**
  4. question figure
    text
    For the URL, "http://localhost:5000/courses/Java", the browser will render:
    **Data Science course found, Java!**
Q22MSQ4.5 marksselect all that apply
Consider the following two tables, user1 and logstable: question figure Consider the following two tables, user1 and logstable:
Text of the picture (copyable)
user1:

| userid | name  | password |
| :----- | :---- | :------- |
| U1     | Mack  | UabZa    |
| U2     | Jack  | ZeFad    |
| U3     | Shaun | UsTZb    |

logstable:

| logid | userid | name      |
| :---- | :----- | :-------- |
| 1     | U1     | Playing   |
| 2     | U2     | Studying  |
| 3     | U3     | Swimming  |
| 4     | U1     | Running   |
| 5     | U3     | Studying  |
| 6     | U2     | Dancing   |

Which of the following query/queries will return the log ID and log name, which are created by user 'Shaun'?
  1. question figure
    text
    ```sql
    select logid, logstable.name from user1 inner join logstable on
    user1.userid = logstable.userid where user1.name = 'Shaun'
    ```
  2. question figure
    text
    ```sql
    select logid, logstable.name from user1 natural join logstable where
    user1.name = 'Shaun'
    ```
  3. question figure
    text
    ```sql
    select logid, logstable.name from user1 inner join logstable on
    user1.name = logstable.name where user1.name = 'Shaun'
    ```
  4. question figure
    text
    ```sql
    select logid, logstable.name from user1, logstable WHERE user1.userid
    = logstable.userid and user1.name = 'Shaun'
    ```
Q23SA2 marks
Compute the octal representation of the binary number (01000001)2 . Note: The answer must be an integer. For ex: If the octal representation is (39)8, then you must write 39 only.
Comprehension passage - the questions below it refer to this
Consider the following jinja2 template, and answer the given subquestions question figure Consider the following jinja2 template, and answer the given subquestions
Q24MCQ3 marks
What will be the output on the terminal for: question figure What will be the output on the terminal for:
Text of the picture (copyable)
```python
data = {'a': 'programming', 'b': 'mathematics', 'c': 'statistics',
'd': 'machine learning'}
```
  1. question figure
    text
    Data science combines programming abilities and competence in
    mathematics and statistics to draw important insights from data.
  2. question figure
    text
    Data science combines programming abilities and competence in
    mathematics and machine learning to draw important insights from data.
  3. question figure
    text
    machine learning combines programming abilities and competence in
    mathematics and statistics to draw important insights from data.
  4. question figure
    text
    KeyError: 'd'
Q25MCQ3 marks
What will be the output on the terminal for: question figure What will be the output on the terminal for:
Text of the picture (copyable)
```python
data = {'b': 'mathematics', 'c': 'statistics', 'd': 'programming'}
```
  1. question figure
    text
    Data science combines {{a}} abilities and competence in
    mathematics and statistics to draw important insights from data.
  2. question figure
    text
    Data science combines abilities and competence in
    mathematics and statistics to draw important insights from data.
  3. question figure
    text
    Data science combines programming abilities and competence in
    mathematics and statistics to draw important insights from data.
  4. question figure
    text
    KeyError: 'a'
Comprehension passage - the questions below it refer to this
Consider the below model definitions, and answer the given subquestions. Consider the following model classes “Movies” and “Producers” corresponding to tables “movies” and “producers”, respectively, in the SQLite database. question figure Consider the below model definitions, and answer the given subquestions. Consider the following model classes “Movies” and “Producers” corresponding to tables “movies” and “producers”, respectively, in the SQLite database.
Q26MCQ3 marks
The tables “movies” and “producers” are related to each other by which of the following relationships?
  1. One-to-one
  2. One-to-many
  3. Many-to-one
  4. Many-to-Many
Q27MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
If an object "p1" that represents an
existing record in the table "producer"
is defined as
```
p1 = Producer.query.get(2),
```
The correct way to create a new record in
the "movies" table that is produced by the
producer represented by object 'p1' using
terminal is.
  1. question figure
    text
    ```python
    >>> mov = Movies(movie_name = 'The movie', movie_year = 2001,
    producers = p1)
    >>> db.session.add(mov)
    >>> db.session.commit()
    ```
  2. question figure
    text
    ```python
    >>> mov = Movies(movie_name = 'The movie', movie_year = 2001)
    >>> p1.producers.append(mov)
    >>> db.session.commit()
    ```
  3. question figure
    text
    ```python
    >>> mov = Movies(movie_name = 'The movie', movie_year = 2001)
    >>> p1.movie.append(mov)
    >>> db.session.commit()
    ```
  4. question figure
    text
    ```python
    mov = Movies(movie_name = 'The movie', movie_year = 2001)
    mov.producers.append(p1)
    db.session.commit()
    ```
Comprehension passage - the questions below it refer to this
Consider the below program, and answer the given subquestions , if the application is running locally on URL: http://127.0.0.1:5000. Consider the following resource created with help of flask-restful. question figure Consider the below program, and answer the given subquestions , if the application is running locally on URL: http://127.0.0.1:5000. Consider the following resource created with help of flask-restful.
Q28MCQ3 marks
If the curl request shown below. question figure If the curl request shown below.
Text of the picture (copyable)
```
curl http://127.0.0.1:5000/api/v1 -X GET -d "{\"employee_id\": \"2003\", \"employee_name\": \"Suresh\"}" -H "Content-Type: application/json"
```
retrieves the employee_id only with status 200 OK, what will come in place of GET-FUNCTION in the code?
  1. question figure
    text
    ```python
    def get(self):
        return {'employee_Id': employee_id}
    ```
  2. question figure
    text
    ```python
    def get(self, employee_id):
        return {'employee_id': employee_id}
    ```
  3. question figure
    text
    ```python
    def get(self):
        args = parser.parse_args()
        return {'Id_no.': args['employee_id']}
    ```
  4. question figure
    text
    ```python
    def get(self):
        args = parser.parse_args()
        return args
    ```
Q29MCQ3 marks
If the curl request shown below question figure If the curl request shown below
Text of the picture (copyable)
```
curl http://127.0.0.1:5000/api/v1/5001 -X POST
retrieves the employee_id only with status 200 OK, what will come in place of
POST-FUNCTION in the code?
```
  1. question figure
    text
    ```python
    def post(self):
        return {'employee_Id': employee_id}
    ```
  2. question figure
    text
    ```python
    def post(self, employee_id):
        return {'employee_id': employee_id}
    ```
  3. question figure
    text
    ```python
    def post(self):
        args = parser.parse_args()
        return {'id_no.': args['employee_id']}
    ```
  4. question figure
    text
    ```python
    def post(self):
        args = parser.parse_args()
        return args
    ```
Q30MCQ4.5 marks
What will be the response from the server for the request: question figure What will be the response from the server for the request:
Text of the picture (copyable)
```
curl http://127.0.0.1:5000/api/v1 -X PUT -d "{\"employee_id\": \"2003\", \"employee_name\": \"Suresh\"}" -H "Content-Type: application/json"
```
  1. question figure
    text
    ```json
    {
        "employee_id": "2003",
        "employee_name": "Suresh"
    }
    ```
  2. question figure
    text
    ```json
    {
      "employee_id": "2003"
    }
    ```
  3. question figure
    text
    ```json
    {
      "employee_name": "Suresh"
    }
    ```
  4. question figure
    text
    None of these
Comprehension passage - the questions below it refer to this
Consider the below graph, and answer the given subquestions. The bandwidth vs. time graph for a period of one hour between 12 noon to 1 p.m in the afternoon is shown below. [Use relations: 1 Byte = 8 bits, 1 GB = 1000 MB and so on.] question figure Consider the below graph, and answer the given subquestions. The bandwidth vs. time graph for a period of one hour between 12 noon to 1 p.m in the afternoon is shown below. [Use relations: 1 Byte = 8 bits, 1 GB = 1000 MB and so on.]
Q31MCQ2 marks
What is the network bandwidth (in Mbps) of the network at exactly 12:30 pm?
  1. 4
  2. 7
  3. 8
  4. 10
Q32MCQ4.5 marks
What is the total amount of data (in GigaBytes) consumed by the only user connected to the network between 12:15 pm to 12:45 pm? [Assuming that the user is using the entire bandwidth from 12:15 p.m to 12:45 p.m]
  1. 12.6
  2. 1.26
  3. 15.75
  4. 1.575

Answer key

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

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 essential for the "Diploma Level: Modern Application Development 1" exam, followed by Mermaid knowledge graphs to visualize relationships.



1. Core Topics & Concepts

A. Web Development Fundamentals

  1. URL Structure

    • Components: Protocol (e.g., http), Domain (e.g., appdev1.com), Path (e.g., /sep-22), Query String (e.g., ?week=2), Fragment (e.g., #MVC).
    • Equation/Example:

      http://appdev1.com/sep-22?week=2#MVC
      Protocol: http
      Domain: appdev1.com
      Path: /sep-22
      Query: ?week=2
      Fragment: #MVC
  1. HTTP Methods & Status Codes

    • GET, POST, PUT, DELETE.
    • Status codes: 200 OK, 401 Unauthorized, 404 Not Found, 500 Server Error.
    • Example:

      @app.route('/logout')
      @login_required
      def logout():
          logout_user()
          return 'logged out'  # HTTP 200
  1. Flask Framework

    • Routing: @app.route('/path').
    • Templates: Jinja2 syntax ({% %}, {{ }}).

      • Example (For Loop):

        {% for item in navigation %}
            <li><a href="{{ item.href }}">{{ item.title }}</a></li>
        {% endfor %}
      • Example (Template Inheritance):

        {% extends 'base.html' %}
    • Forms & User Authentication:

      • flask_login (e.g., login_user, logout_user, @login_required).
      • Example:

        @login_manager.user_loader
        def load_user(user_id):
            return User.query.get(int(user_id))
    • Flask-RESTful:

      • Resources, reqparse, marshal_with.
      • Example:

        parser = reqparse.RequestParser()
        parser.add_argument('employee_id')
  1. HTML/CSS

    • Inline vs. Internal vs. External Styles:

      • Precedence: Inline > Internal > External.
    • Example:

      <p style="color: red;">Inline CSS</p>  <!-- Highest precedence -->
  1. Jinja2 Templating

    • Variable Rendering: {{ variable }}.
    • Conditionals/Loops:

      {% if user %} Hello {{ user }}! {% endif %}
    • Template Inheritance: {% extends 'base.html' %}.

B. Databases & SQL

  1. SQL Queries

    • SELECT, WHERE, JOIN (INNER, NATURAL), GROUP BY.
    • Example (JOIN):

      SELECT logid, logstable.name
      FROM user1
      INNER JOIN logstable ON user1.userid = logstable.userid
      WHERE user1.name = 'Shaun';
    • Example (Filtering):

      User.query.filter_by(name='Ram').all()  # Equivalent to SQL WHERE
  1. SQLAlchemy (ORM)

    • Model Definition:

      class User(db.Model):
          id = db.Column(db.Integer, primary_key=True)
          name = db.Column(db.String(30))
    • Relationships:

      • One-to-Many, Many-to-Many (using secondary table).
      • Example (Many-to-Many):

        producers = db.relationship('Producer', secondary='groups')
  1. Indexing

    • Improves query performance on frequently searched columns (e.g., Department in WHERE clauses).
    • Example:

      CREATE INDEX idx_department ON student(Department);

C. Version Control (Git)

  1. Key Concepts

    • Staging Area vs. Working Directory: Files can exist in both simultaneously.
    • Branching:

      git checkout -b new_branch  # Creates and switches to `new_branch`
    • Centralized vs. Distributed: Git is distributed (not centralized).
  1. Commands

    • git add, git commit, git push, git checkout.

D. Software Engineering Practices

  1. Continuous Integration (CI) & Delivery (CD)

    • CI: Automates integration of code changes (e.g., GitHub Actions, Jenkins).
    • CD: Automates delivery of release packages after successful tests.
  1. Testing

    • Unit Testing with pytest:

      • Example:

        def test_answer():
            assert dec(3) == 2  # Fails if dec(3) returns 3
      • Output for failure:

        assert 2 == 3

E. Networking

  1. Bandwidth Calculation

    • Units: 1 Byte = 8 bits, 1 GB = 1000 MB.
    • Example:

      • If bandwidth is 7 Mbps for 30 minutes (1800 seconds):

        Total data = 7 Mbps * 1800 s = 12600 Mbits = 1.575 GB

F. Algorithms & Complexity

  1. Time Complexity

    • Compare O(N²) vs. O(N) for small inputs (e.g., N ∈ [0, 3]).
    • Example:

      • T_A(N) = 2N² + 9 vs. T_B(N) = N²:

        • For N=3: T_A(3) = 27, T_B(3) = 9 → B is faster.

G. Data Structures

  1. Relationships in SQLAlchemy

    • Many-to-Many: Requires a secondary table (e.g., Groups for Movies and Producers).
    • Example:

      class Groups(db.Model):
          movie_id = db.Column(db.Integer, db.ForeignKey('movies.id'), primary_key=True)
          prod_id = db.Column(db.Integer, db.ForeignKey('producer.id'), primary_key=True)


2. Key Equations & Code Snippets

TopicEquation/Code
URL Structureprotocol://domain/path?query#fragment
Flask Route@app.route('/path')
Jinja2 For Loop{% for item in list %} {{ item }} {% endfor %}
SQL JOINSELECT * FROM A INNER JOIN B ON A.id = B.id WHERE A.name = 'X';
SQLAlchemy FilterUser.query.filter_by(name='Ram').all()
Git Branchgit checkout -b new_branch
Bandwidth to DataData (GB) = Bandwidth (Mbps) * Time (s) / (8 * 1000²)
Time ComplexityO(N²) vs. O(N) for N ∈ [0, 3]
Flask-RESTful Parserparser.add_argument('field')
Pytest Assertionassert function(input) == expected_output


Graph 2: Database & SQL

Graph 3: Version Control & Testing

Graph 4: Networking & Algorithms



4. Exam Tips

  1. Flask: Focus on routing, templating, and user authentication.
  2. SQL: Practice JOIN queries and SQLAlchemy relationships.
  3. Git: Know branching, staging, and distributed vs. centralized.
  4. Testing: Understand pytest assertions and failure messages.
  5. Networking: Convert bandwidth to data units (Mbps → GB).
  6. Jinja2: Master loops, conditionals, and template inheritance.