MAD Study Hub

Home / Past papers / MAD1 Quiz 1 / this paper

IIT M DIPLOMA AN2 EXAM QPD2 29 Oct 2023 - 29 Oct 2023

MAD1 Quiz 116 questions50 marks12 MCQ · 4 MSQDiploma / QPD2
Elapsed 00:00
Q1MCQ2 marks
What does the term “responsive” mean in the context of web design?
  1. The ability of a webpage to give visual feedback on any kind of user input.
  2. The ability of a webpage to change its color scheme to “night mode”.
  3. The ability of a webpage to alter its layout and appearance to suit differentscreen widths, resolutions, etc.
  4. All of these.
Q2MCQ2 marks
Match the following HTTP methods in Column A with their conventional usage in Column B. question figure Match the following HTTP methods in Column A with their conventional usage in Column B.
Text of the picture (copyable)
| | Column A | | Column B |
|---|---|---|---|
| 1 | GET | a | Send data to a server to create/update a resource |
| 2 | HEAD | b | Update a resource |
| 3 | PUT | c | method, generally used to request a resource from the server. |
| 4 | POST | d | Asks for a response identical to that of a GET request, but without the response body |
  1. 1-c, 2-d, 3-b, 4-a
  2. 1-c, 2-b, 3-d, 4-a
  3. 1-c, 2-d, 3-a, 4-b
  4. 1-a, 2-d, 3-b, 4-c
Q3MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following HTML document.

```html
<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <style>
        div{
            margin: auto;
            padding: auto;
            background-color: aqua !important;
            width:225px;
            text-align: center;
            color:blue;
        }
    </style>
</head>
<body>
    <div style="border:4px solid purple;background-color:lightgrey;color:red;">
        <h2>Welcome to IITM</h2>
    </div>
</body>
</html>
```
Which of the following is correct rendered output ?
  1. question figure
    text
    Welcome to IITM
  2. question figure
    text
    Welcome to IITM
  3. question figure
    text
    Welcome to IITM
  4. question figure
    text
    Welcome to IITM
Q4MCQ3 marks
Consider the following DOM structure and select the HTML document that correctly represents the DOM structure . question figure Consider the following DOM structure and select the HTML document that correctly represents the DOM structure .
Text of the picture (copyable)
This is a diagram representing a hierarchical structure, likely a Document Object Model (DOM) tree for an HTML document.

The diagram consists of several nodes connected by lines, indicating parent-child relationships.

**Nodes (from top to bottom, left to right):**

*   **Document** (purple rectangle with rounded corners)
*   **html** (purple rectangle with rounded corners)
*   **<Head>** (blue rectangle with rounded corners)
*   **<title>** (yellow rectangle with rounded corners)
*   **"My title"** (brown rectangle with rounded corners)
*   **<body>** (blue rectangle with rounded corners)
*   **<h1>** (yellow rectangle with rounded corners)
*   **"A heading"** (brown rectangle with rounded corners)
*   **<a>** (yellow rectangle with rounded corners)
*   **Attr=href** (grey rectangle with rounded corners)
*   **"Link text"** (brown rectangle with rounded corners)

**Connections:**

*   Document is parent of html.
*   html is parent of <Head>.
*   html is parent of <body>.
*   <Head> is parent of <title>.
*   <title> is parent of "My title".
*   <body> is parent of <h1>.
*   <body> is parent of <a>.
*   <h1> is parent of "A heading".
*   <a> is parent of "Link text".
*   <a> is parent of Attr=href.
  1. question figure
    text
    ```html
    <!DOCTYPE html>
    <head>
        <title>My title</title>
    </head>
    <body>
        <h1>A heading</h1>
        <a href="link">Link text</a>
    </body>
    ```
  2. question figure
    text
    ```html
    <!DOCTYPE html>
    <html>
    <head>
        <title>My title</title>
    </head>
    <body>
        <h1>A heading</h1>
        <a>Link text</a>
    </body>
    </html>
    ```
  3. question figure
    text
    ```html
    <!DOCTYPE html>
    <html>
    <head>
        <title>My title</title>
    </head>
    <body>
        <h1>A heading</h1>
        <a>Link text</a>
    </body>
    </html>
    ```
  4. question figure
    text
    ```html
    <!DOCTYPE html>
    <html>
    <head>
        <title>My title</title>
    </head>
    <body>
        <h1>A heading</h1>
        <a href="link">Link text</a>
    </body>
    </html>
    ```
Q5MCQ3 marks
Consider the following python code snippet. question figure Consider the following python code snippet.
Text of the picture (copyable)
```python
from jinja2 import Template as T1
from string import Template as T2

info = {'city1': 'Mumbai', 'city2': 'Delhi',
        'city3': 'city2', 'city4': 'city1',
        'country1':'India', 'country2':'country1'}

t1 = T1("${{city3}} and ${{city4}} are the national and financial capitals of ${{country2}} respectively.")

out1 = t1.render(info)
print(out1)
out2 = T2(out1)
print(out2.substitute(info))
```

What is the generated output on python console?
  1. question figure
    text
    city2 and city1 are the national and financial capitals of country1 respectively.
    Delhi and Mumbai are the national and financial capitals of India respectively.
  2. question figure
    text
    $city2 and $city1 are the national and financial capitals of $country1 respectively.
    Delhi and Mumbai are the national and financial capitals of India respectively.
  3. question figure
    text
    ```
    {{city2}} and {{city1}} are the national and financial capitals of {{country1}} respectively.
    Delhi and Mumbai are the national and financial capitals of India respectively.
    ```
  4. question figure
    text
    $city3 and $city4 are the national and financial capitals of $country2 respectively.
    Delhi and Mumbai are the national and financial capitals of India respectively.
Q6MCQ3 marks
question figure
Text of the picture (copyable)
Which of the following flask view functions will return a 404 error for the URL:
http://127.0.0.1:5000/home/student1/2001 ?
  1. question figure
    text
    ```python
    @app.route('/home/<student_id>/<course_id>')
    def home(student_id, course_id):
        details = {'student_id': student_id, 'course_id': course_id}
    ```
  2. question figure
    text
    ```python
    @app.route('/home/<string:student_id>/<int:course_id>')
    def home(student_id, course_id):
        details = { 'student_id': student_id, 'course_id' : course_id}
    ```
  3. question figure
    text
    ```python
    @app.route('/home/<string:student_id>/<string:course_id>')
    def home(student_id, course_id):
        details = {'student_id': student_id, 'course_id': course_id}
    ```
  4. question figure
    text
    ```python
    @app.route('/home/student/<student_id>/<course_id>')
    def home(student_id, course_id):
        details = {'student_id': student_id, 'course_id': course_id}
    ```
Q7MCQ3 marks
Consider a character set L, which consists of only those characters which are used in the statement, “pack my box with five dozen liquor jugs”. If this statement is to be saved in a document with minimum encoding, what will be the size of the document given that no other information or context is to be saved?
  1. 160 bits
  2. 320 bits
  3. 195 bits
  4. 390 bits
Q8MCQ3 marks
A certain video that was available on the web only for an hour occupied 2 gigabytes of memory of the server. If the number of viewers of the video over time for that hour is given by the curve shown below and assuming that each viewer required an individual connection to the server to view the video, what would be the minimum RAM requirement of the server that could process requests from all the viewers simultaneously at any point of time? question figure A certain video that was available on the web only for an hour occupied 2 gigabytes of memory of the server. If the number of viewers of the video over time for that hour is given by the curve shown below and assuming that each viewer required an individual connection to the server to view the video, what would be the minimum RAM requirement of the server that could process requests from all the viewers simultaneously at any point of time?
Text of the picture (copyable)
This is an area chart.
The x-axis is labeled "Time (minutes)" and ranges from 0 to 60 in increments of 10.
The y-axis is labeled "No. of viewers (in Hundreds)" and ranges from 0 to 20 in increments of 5.
The area under the line is shaded in a light red color.
The line graph shows the following approximate points:
(0, 12)
(10, 7)
(15, 9)
(20, 14)
(25, 15)
(30, 6)
(35, 4)
(40, 9)
(45, 17)
(50, 15)
(55, 6)
(60, 4)
  1. 1.7 GB
  2. 3.4 GB
  3. 1.7 TB
  4. 3.4 TB
Q9MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet.

```python
from string import Template

statement = "$g http method is used to retrieve information while $p for sending information"

out = Template(statement)

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

Which of the following statements, when substituted in place of === OUTPUT ===, will throw a KeyError?
  1. question figure
    text
    ```python
    out.substitute({'g': 'GET'})
    ```
  2. question figure
    text
    ```
    out.substitute({'g': 'GET', 'p': 'POST', 'd': 'delete'})
    ```
  3. question figure
    text
    ```python
    out.safe_substitute({'g':'GET'})
    ```
  4. question figure
    text
    ```python
    out.safe_substitute({'g':'GET', 'p':'POST', 'd':'delete'})
    ```
Q10MCQ3 marks
question figure
Text of the picture (copyable)
Consider the following Python code snippet "code.py".
Filename: code.py
```python
import sys
from jinja2 import Template

vars = sys.argv
myTech = {'mad 1': 'backend', 'mad 2': 'frontend'}

temp = Template("This course focuses on {{var}} development.")

if vars[1] == 'mad 1':
    print(temp.render(myTech['mad 1']))
elif vars[1] == 'mad 2':
    print(temp.render(myTech['mad 2']))
else:
    print("Mention the course name specifically.")
```
What will be the output on the terminal for input: python code.py mad 1?
  1. question figure
    text
    This course focuses on frontend development.
  2. question figure
    text
    This course focuses on backend development.
  3. question figure
    text
    Mention the course name specifically.
  4. question figure
    text
    ```
    IndexError: list index out of range
    ```
Q11MCQ4.5 marks
question figure
Text of the picture (copyable)
Consider the following flask application.
app.py

```python
from flask import Flask, request
app = Flask(__name__)
@app.route('/calculate')
def calculate():
    a = request.args.get('a')
    b = request.args.get('b')
    operator = request.args.get('operator')
    if a and b and operator:
        a = int(a)
        b = int(b)
        if operator == 'one':
            return f'{a} + {b} = {a+b}'
        elif operator == 'two':
            return f'{a} - {b} = {a-b}'
        elif operator == 'three':
            return f'{a} x {b} = {a*b}'
        elif operator == 'four':
            return f'{a}/{b} = {a/b}'
    else:
        return 'Error: Insufficient arguments'
app.run(debug=True)
```

If the application is running locally on http://127.0.0.1:5000 then match the URLs with their rendered output?

| | URLs | | Output |
|---|---|---|---|
| 1 | http://localhost:5000/calculate?a=3&b=1&operator=four | a | 3 x 1 = 3 |
| 2 | http://localhost:5000/calculate?a=3&b=1&operator=one | b | 3/1 = 3.0 |
| 3 | http://localhost:5000/calculate?a=3&b=1&operator=two | c | 3 - 1 = 2 |
| 4 | http://localhost:5000/calculate?a=3&b=1&operator=three | d | 3 + 1 = 4 |
  1. 1-b, 2-d, 3-a, 4-c
  2. 1-b, 2-d, 3-c, 4-a
  3. 1-c, 2-d, 3-a, 4-b
  4. 1-a, 2-d, 3-b, 4-c
Q12MCQ4.5 marks
A mobile server and a client initially 750 km apart are moving towards each other in a straight line with the speeds of 165 kmph and 85 kmph respectively. The network bandwidth is set constant to 2 Mbps. Determine how much data (in Gigabytes) is used by the client before the client and the server collide. [speed of light in vacuum: 3 x 108 m/sec, 1 MB = 1000 KB and so on.]
  1. 21.6
  2. 6
  3. 2.7
  4. 7.5
Q13MSQ2 marksselect all that apply
Which of the following entities and their relationship has been correctly represented by the ER diagram shown in the image? question figure Which of the following entities and their relationship has been correctly represented by the ER diagram shown in the image?
Text of the picture (copyable)
This is a diagram of a curve.
It shows a black S-shaped curve on a light grey background.
The curve starts at the bottom left, goes up diagonally, then curves to the right, and ends at the top right.
There are two short vertical lines intersecting a short horizontal line at the bottom left end of the curve.
There are two short vertical lines intersecting a short horizontal line at the top right end of the curve.
  1. Person - Passport
  2. Person - Mobile number
  3. Person - Birth certificate
  4. Person - Fingerprint
Q14MSQ2 marksselect all that apply
Which of the following statements regarding dynamic webpages is/are true?
  1. The page is already present at the server even before a user requests it.
  2. The page generally maintains the same content every time the user requestsit.
  3. The page is generated on demand by a program or a request from a browser.
  4. On every request, every new page created may be different from the last.
Q15MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following HTML document.

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <style>
        span {
            background-color: yellow;
            color: red;
            ===code1===
        }
        .class {
            border: 2px solid purple;
            color:blue ;
        }
        #id {
            background-color: aqua;
            color: red;
        }
    </style>
</head>
<body>
    <span class="class" id="id">SPAN 1</span>
    <span class="class">SPAN 2</span>
    <span>SPAN 3</span>
</body>
</html>
```

Which of the following is/are correct rendered output for given ===code1===?
  1. question figure
    text
    If ===code1=== is replaced by:
    
    ```
    display:inline-block;
    border: 2px solid purple;
    ```
    
    Output:
    
    A diagram showing three rectangular boxes arranged horizontally.
    - The first box has a purple border, a light blue background, and contains the text "SPAN 1" in red.
    - The second box has a purple border, a yellow background, and contains the text "SPAN 2" in red.
    - The third box has a purple border, a yellow background, and contains the text "SPAN 3" in red.
  2. question figure
    text
    If ===code1=== is replaced by:
    
    ```
    display:block;
    color: blue;
    ```
    
    Output:
    
    SPAN 1
    SPAN 2
    SPAN 3
  3. question figure
    text
    If ===code1=== is replaced by:
    
    ```
    color: blue;
    border: 2px solid purple;
    ```
    
    Output :
    
    SPAN 1 SPAN 2 SPAN 3
  4. question figure
    text
    If ===code1=== is left blank:
    
    Output:
    
    [SPAN 1] [SPAN 2] [SPAN 3]
Q16MSQ4.5 marksselect all that apply
question figure
Text of the picture (copyable)
Consider the following flask application.
app.py

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

@app.route("/if")
def ifelse():
    user = "MAD I"
    return render_template("if_example.html", name=user)

@app.route("/for")
def for_loop():
    list_of_courses = ['Java', 'Python', 'DBMS', 'PDSA']
    return render_template("for_example.html", courses=list_of_courses)

@app.route("/choice/<pick>")
def choice(pick):
    if pick == 'if':
        return url_for('ifelse')
    if pick == 'for':
        return (url_for('for_loop'))

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

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/choice/for browser will render for_example.html
  2. question figure
    text
    For URL, http://127.0.0.1:5000/choice/if browser will render if_example.html
  3. question figure
    text
    For URL http://127.0.0.1:5000/choice/for browser will display /for as output.
  4. question figure
    text
    For URL http://127.0.0.1:5000/choice/if browser will display /if as output.

Answer key

  1. Q1 (MCQ, 2 marks): C
  2. Q2 (MCQ, 2 marks): A
  3. Q3 (MCQ, 3 marks): C
  4. Q4 (MCQ, 3 marks): D
  5. Q5 (MCQ, 3 marks): B
  6. Q6 (MCQ, 3 marks): D
  7. Q7 (MCQ, 3 marks): C
  8. Q8 (MCQ, 3 marks): D
  9. Q9 (MCQ, 3 marks): A
  10. Q10 (MCQ, 3 marks): C
  11. Q11 (MCQ, 4.5 marks): B
  12. Q12 (MCQ, 4.5 marks): C
  13. Q13 (MSQ, 2 marks): A, C, D
  14. Q14 (MSQ, 2 marks): C, D
  15. Q15 (MSQ, 4.5 marks): A, C, D
  16. Q16 (MSQ, 4.5 marks): C, D

Concepts this paper tests

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

Summary of Core Topics, Concepts, Principles, and Equations

Web Design and Development

  1. Responsive Web Design:

    • Concept: Designing web pages to adapt to different screen sizes and resolutions.
    • Principle: Use flexible layouts, flexible images, and CSS media queries.
  1. HTTP Methods:

    • Concept: Different HTTP methods (GET, POST, PUT, HEAD) and their uses.
    • Principles:

      • GET: Retrieve data from the server.
      • POST: Send data to the server to create/update a resource.
      • PUT: Update a resource.
      • HEAD: Similar to GET but without the response body.
  1. CSS Specificity and Inheritance:

    • Concept: How styles are applied based on specificity and inheritance rules.
    • Principles: Inline styles > ID selectors > Class selectors > Element selectors.
  1. Flask Framework:

    • Concept: A micro web framework for Python.
    • Principles: Routing, templates, and request handling.
    • Example:

      @app.route('/path')
      def function():
          return "Response"
  1. Dynamic Web Pages:

    • Concept: Web pages generated on demand.
    • Principles: Content can change based on user input, time of day, or other factors.

Data Science and Mathematics

  1. Data Encoding:

    • Concept: Representing data in a specific format for storage or transmission.
    • Equation: Size of document = Number of characters * Bits per character.
  1. Relative Motion and Data Transfer:

    • Concept: Calculating data transfer based on relative motion and bandwidth.
    • Equation: Data = Bandwidth * Time.
    • Example: Calculating data used before collision of two moving objects.
  1. Character Set and Encoding:

    • Concept: Determining the size of a document based on the character set and encoding.
    • Equation: Document size = Number of characters * Bits per character.

Software Engineering

  1. Templating Engines (Jinja2, String Template):

    • Concept: Using templates to generate dynamic content.
    • Principles: Placeholders, substitution, and rendering.
    • Example:

      from jinja2 import Template
      template = Template("Hello, {{ name }}!")
      output = template.render(name="World")
  1. Error Handling and Exceptions:

    • Concept: Handling errors and exceptions in code.
    • Principles: Using try-except blocks, checking for KeyError, etc.
  1. Entity-Relationship (ER) Diagrams:

    • Concept: Representing entities and their relationships in a database.
    • Principles: Entities, attributes, and relationships.

Web Design and Development

Data Science and Mathematics

Software Engineering

These summaries and graphs should help you focus on the essential topics and understand the relationships between different concepts for your exam.