MAD Study Hub

Home / Past papers / MAD2 End Term / this paper

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

MAD2 End Term32 questions100 marks25 MCQ · 7 MSQDiploma
Elapsed 00:00
Q1MCQ2 marks
Consider the below Vue component and Vuex store definition. question figure Consider the below Vue component and Vuex store definition. Which of the following is the best suitable definition of the “code” placeholder in the above app (assuming the store is binded with the Vue app, and the mapState is imported appropriately)?
Text of the picture (copyable)
```javascript
const store = new Vuex.Store({
    state : {
        stateA : 10,
        stateB : 20,
        stateC : 30,
    }
})

Vue.component('Vuex-demo', {
    template : `
        <div>
            state A : {{stateA}}
            state B : {{stateB}}
            state C : {{stateC}}
        </div>
    `,
    computed : code
})
```
  1. …mapState(['state_1', 'state_2', 'state_3'])
  2. mapState(['state_1', 'state_2', 'state_3'])
  3. Both …mapState(['state_1', 'state_2', 'state_3']) and mapState(['state_1','state_2', 'state_3'])
  4. A Vue component cannot access Vuex store state.
Q2MCQ2 marks
Suppose you are writing an application to be used by lakhs of people, which will run a brute force algorithm and gives back the result to the user of the application when ready. Considering this context, arrange the below set of actions/operations to achieve a desirable and practical design. I. Invoke the webhook II. Relieve the worker III. Dispatch a backend job
  1. I, III, II
  2. III, I, II
  3. I, II, III
  4. The polling will be a better design.
Q3MCQ2 marks
Which of the following statements is false regarding caching?
  1. A shared cache is generally suitable for storing the personalized responses.
  2. A private cache is usually tied to a specific client.
  3. The caching helps in improving the performance of a web application.
  4. Caching at browser level provides the least latency, if compared with proxylevel.
Q4MCQ2 marks
Suppose you want to store some data on the client, which has to be sent back to the server with every subsequent request. Which of the following is the most suited for this purpose?
  1. Local Storage
  2. Session Storage
  3. Cookie
  4. Any of these can be used
Q5MCQ2 marks
Suppose an application is being loaded from the origin http://origin2.com. Which of the following origins the browser will allow while making a fetch call, by default?
  1. http://origin2.com
  2. http://api.origin2.com
  3. http://origin1.com/api/
  4. All of these
Q6MCQ3 marks
Which of the following shows the correct output, if the below program is executed? question figure Which of the following shows the correct output, if the below program is executed?
Text of the picture (copyable)
```javascript
for (let i=1; i<4; i+=2)
    setTimeout(() => console.log(i), 0)
```
  1. 13
  2. 123
  3. 55
  4. 555
Q7MCQ3 marks
If an application is entirely built on the client end using javascript (without a database). Which of the following statements is true?
  1. All the progress will always be lost on the force reload of the page.
  2. All the progress may not necessarily be lost on the force reload of the page.
  3. The application will not allow force reload of the page.
  4. The progress made in a machine can be accessed on another machine.
Q8MCQ3 marks
Suppose a particular user of an application hosted on http://example1.com has delete privilege and URL to delete resource with ID 1 is ‘http://example1.com/delete?id=1’. The user visits a malicious website having an image link with definition “”, and the user clicks on the link, which in turn leads to the deletion of the resource without the knowledge of the user. Which of the following correctly describes the above scenario?
  1. Cross Site Scripting
  2. Cross Site Request Forgery
  3. Session Hijacking
  4. None of these
Q9MCQ3 marks
Consider the following javascript program. What will be logged on to console after executing the program? question figure Consider the following javascript program. What will be logged on to console after executing the program?
Text of the picture (copyable)
```javascript
const promiseFactory = (data) => {
  return new Promise((resolve) => {
    resolve(data)
  })
}

result = []
p1 = promiseFactory('App Dev I')
p1.then((data) => {
  result.push(data)
  return promiseFactory('App Dev II')
}).then((data) => {
  result.push(data)
})

console.log(result)
```
  1. []
  2. [‘App Dev I’, ‘App Dev II’]
  3. [‘App Dev II’, ‘App Dev I’]
  4. [‘App Dev I’]
Q10MCQ3 marks
Consider the following javascript code. What will be logged on the console after executing this program? question figure Consider the following javascript code. What will be logged on the console after executing this program?
Text of the picture (copyable)
```javascript
const Person = function (name, city, pinCode) {
    this.name = name
    this.city = city
    this.pin = pinCode
}

Person.prototype.getAddress = function () {
    return `Name: ${this.name}, City: ${this.city}, ${this.pin}`
}

per1 = new Person('Mayank', 'Delhi', '110001')
console.log(per1.getAddress())
```
  1. Name: , City: , Pin:
  2. Name: Mayank, City: Delhi, Pin: 110001
  3. Name: Mayank, City: Delhi, 110001
  4. None of these
Q11MCQ3 marks
Consider the following javascript program. What will be logged on to console after executing this program? question figure Consider the following javascript program. What will be logged on to console after executing this program?
Text of the picture (copyable)
```javascript
const promiseFactory = (isShopOpen) => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (isShopOpen) {
        resolve('Making Coffee')
      } else {
        reject('Making Tea')
      }
    }, 1000)
  })
}

const bringTea = promiseFactory(false)
bringTea
  .then((data) => {
    console.log(data)
  })
  .catch((data) => {
    console.log(data)
  })
console.log('Boiling Water ....')
```
  1. Boiling Water ….
  2. Boiling Water ….Making Coffee
  3. Boiling Water ….Making Tea
  4. Making CoffeeBoiling Water ….
Q12MCQ3 marks
Consider the following Vue application with markup “index.html” and javascript file “app.js”. question figure Consider the following Vue application with markup “index.html” and javascript file “app.js”. Suppose the application is running on ‘http://localhost:8080’. What will be the background colour of seat with seatNo 1 and 2 respectively, when the user visits the home page of the application (Assume the default background colour of button to be white)?
Text of the picture (copyable)
index.html:
```html
<head>
    <style>
        .booked {
            background-color: green;
        }
    </style>
</head>
<body>
    <div id="app">
        <button :class="{booked:seat.isBooked}" v-for="seat in seats">
            {{seat.seatNo}}
        </button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="app.js"></script>
</body>
```

app.js:
```javascript
new Vue({
    el: '#app',
    data: {
        seats: [
            { seatNo: 1, isBooked: true },
            { seatNo: 2, isBooked: false },
            { seatNo: 3, isBooked: true },
        ],
    }
})
```
  1. Green, Green
  2. Green, White
  3. White, White
  4. White, Green
Q13MCQ4.5 marks
Consider the following javascript program, and predict the output, if executed in a REPL environment. question figure Consider the following javascript program, and predict the output, if executed in a REPL environment.
Text of the picture (copyable)
```javascript
var a = 39
const obj1 = {
    'a' : 50,
    'func' : function () {
        let in_func = () => console.log("This :", this.a, ", Normal :", a)
        in_func();
    }
}

const obj2 = {
    'a' : 60,
    'func' : function () {
        let in_func = () => console.log("This :", this.a, ", Normal :", a)
        in_func();
    }
}

obj1.func.call()
```
  1. This : 39 , Normal : 39
  2. This : undefined , Normal : 39
  3. This : undefined , Normal : 50
  4. This : 39 , Normal : 50
Q14MCQ4.5 marks
Consider the below javascript program, and predict the output, if executed. Also, what will be the minimum time taken by the program to execute? question figure Consider the below javascript program, and predict the output, if executed. Also, what will be the minimum time taken by the program to execute?
Text of the picture (copyable)
```javascript
exams = ['endterm', 'quiz2', 'quiz1']

new Promise((rej, res) => {
    let count = 2
    let a = setInterval(() => {
        count += 3;
        exams.pop();
        if (count % 2) {
            exams.push('quiz1')
        }
        if (count % 17 == 0) {
            clearInterval(a);
            rej();
        }
    }, 2000)
}).then(d => console.log("Rejected", exams))
  .catch(e => console.log("Resolved", exams))
```
  1. Rejected [‘quiz1’]Minimum Time taken: 10 seconds
  2. Rejected [‘quiz1’]Minimum Time taken: 8 seconds
  3. Resolved [‘quiz1’]Minimum Time taken: 8 seconds
  4. Resolved [‘quiz1’]Minimum Time taken: 10 seconds
Q15MCQ4.5 marks
Consider the following Vue application with markup “index.html” and javascript file “app.js”. question figure Consider the following Vue application with markup “index.html” and javascript file “app.js”. Suppose you open “index.html” file in a browser, and type the text “EndTermExam” in the text box shown (after removing the previous text, if any), and hard refresh the page thrice, without clicking anywhere. What will be the value shown in the text box, and the “marks” placeholder, respectively?
Text of the picture (copyable)
index.html:

```html
<div id = "app">
    <input v-model = "subject" @change = "compute_marks">
    <p> {{marks}} </p>
</div>
<script scr = "app.js"></script>
```

app.js:

```javascript
new Vue({
    el : "#app",
    data : {
        subject : "AppDev",
        marks : 50,
    },

    mounted () {
        this.subject = "AppDev";
        this.marks = 50;

        if (localStorage.marks) {
            this.subject += "1";
            this.marks = localStorage.marks + 20;
        }
        else {
            this.subject += "2";
            this.marks += 20;
        }
    },

    methods : {
        compute_marks() {
            localStorage.setItem("subject", this.subject);
            localStorage.setItem("marks", this.marks + 10);
        }
    }
})
```
  1. AppDev1, 80
  2. AppDev2, 80
  3. AppDev1, 70
  4. AppDev2, 70
Q16MCQ4.5 marks
Consider the following Vue application with markup “index.html” and javascript file “app.js”. question figure Consider the following Vue application with markup “index.html” and javascript file “app.js”. Suppose the application is running on ‘http://localhost:8080’. If the user clicks on the button with the text “Extra”, and then clicks on the button with the text “Run” thrice. What will be rendered inside the element with ID “total” and “player”, respectively?
Text of the picture (copyable)
index.html:
```html
<body>
    <div id="app">
        <h4 id="total">Total Run: {{total}}</h4>
        <h4 id="player">{{Player.name}}: {{Player.run}}</h4>
        <button @click="extra=true">Extra</button>
        <button @click="addRuns(4)">Run</button>
    </div>
    <script
        src="https://cdn.jsdelivr.net/npm/vue@2.7.8/dist/vue.js"></script>
    <script src="app.js"></script>
</body>
```

app.js:
```javascript
new Vue({
    el: '#app',
    data: {
        extra: false,
        total: 20,
        Player: { name: 'M.S. Dhoni', run: 10 }
    },

    methods: {
        addRuns(run) {
            if (this.extra === true) {
                this.Player.run += run
            }
            this.total += run
            this.extra = false
        },
    }
})
```
  1. Total Run: 32, M.S. Dhoni: 14
  2. Total Run: 28, M.S. Dhoni: 14
  3. Total Run: 32, M.S. Dhoni: 18
  4. Total Run: 28, M.S. Dhoni: 18
Q17MCQ4.5 marks
Consider the following javascript program, and predict the output if executed. question figure Consider the following javascript program, and predict the output if executed.
Text of the picture (copyable)
```javascript
new Promise((arg1, arg2) => {
  if (5 === "5") arg2(5)
  else arg1(5)
}).
then(d => {
  console.log("Checkpoint 3", d);
  throw new Error(20);
  return d * 5;
})
.then(d => {
  console.log("Checkpoint 1", d);
  return d;
})
.catch(e => {
  console.log("Checkpoint 4");
  return 5;
}).finally(d => {
  console.log("Checkpoint 6", d);
  return d * 5;
}).then(d => {
  console.log("Checkpoint 2", d);
  return d * 5;
})
```
  1. Checkpoint 4 11Checkpoint 6 undefinedCheckpoint 2 25
  2. Checkpoint 4 11Checkpoint 6 25Checkpoint 2 125
  3. Checkpoint 3 5Checkpoint 4Checkpoint 6 undefinedCheckpoint 2 5
  4. Checkpoint 3 5Checkpoint 4Checkpoint 6 NaNCheckpoint 2 5
Q18MSQ2 marksselect all that apply
Which of the following statement(s) is/are false in the context of point-to-point communication and message broker?
  1. In point-to-point communication, the number of connections grow with theorder of O(nlogn).
  2. If a central message broker is used, the number of connections grow with theorder of O(logn).
  3. If a central message broker is used, the number of connections grow with theorder of O(n).
  4. A message broker makes the network more scalable, if compared with point-to-point communication.
Q19MSQ2 marksselect all that apply
Which of the following statement(s) is/are false?
  1. The CSRF protection is not enforced by the flask framework, by default.
  2. The data stored in local storage is synchronized across the devices for a givenuser.
  3. A flask application returns CORS headers for cross domain javascript requests,by default.
  4. The flask application uses port number 5000, by default.
Q20MSQ2 marksselect all that apply
Which of the following is/are true regarding session cookies?
  1. They get deleted once the user closes the browser.
  2. They will be sent to the origin server with each request, by default.
  3. They will not be sent to the origin server with each request, by default.
  4. All of these
Q21MSQ3 marksselect all that apply
Which of the following statement(s) is/are false regarding javascript language?
  1. JavaScript is a high level programming language.
  2. JavaScript moves the declaration of all the arrow functions to the top of theirscope.
  3. The language does not allow the global declaration of user defined functions.
  4. A function can be invoked inside another function in the language.
Q22MSQ3 marksselect all that apply
Consider the below Vue class binding and select the incorrect option(s). question figure Consider the below Vue class binding and select the incorrect option(s).
Text of the picture (copyable)
```html
<div v-bind:class="[isClassA ? classA : '', classB]"></div>
```
  1. The classes, namely “classA” and “classB” will always be applied to the divelement.
  2. The class, namely “classB” will always be applied to the div element.
  3. The class, namely “classA” will only be applied to the div element, if the variable“isClassA” evaluates to true.
  4. The class, namely “classB” will only be applied to the div element, if no variablewith name “isClassA” exists.
Q23MSQ3 marksselect all that apply
Which of the following statement(s) is/are true in the context of scaling a web application?
  1. Scaling out is always a preferred choice when the network traffic is growing.
  2. The horizontal scaling will typically clone the application as many times asrequired, and add a load balancer to maintain uniform traffic across the servers.
  3. The horizontal partitioning splits a given table into multiple tables, with eachtable having the same structure.
  4. The diagonal scaling refers to cloning the application first, and then scaling upthe different servers to meet the requirements.
Q24MSQ3 marksselect all that apply
Which of the following statement(s) is/are true?
  1. A flask application runs in a threaded mode by default.
  2. A fetch API call always returns a promise.
  3. The promise returned by fetch API resolves to an HTTP response status 500,with the “ok” property of the response set to true.
  4. A headless CMS aims to manage both the content and frontend via APIs.
Comprehension passage - the questions below it refer to this
question figure
Q25MCQ3 marks
Suppose the application is running on ‘http://localhost:8080’. What will be rendered by the browser inside the div element with ID ‘slot-detail’, when the user visits the website home page for the first time (except the button)?
  1. Slot ID: 1, Slot Status: Booked
  2. Slot ID: 1, Slot Status: Not Booked
  3. Slot ID: 1
  4. Slot Status: Booked
Q26MCQ3 marks
Suppose the application is running on ‘http://localhost:8080’. What will be rendered by the browser inside the div element with ID ‘slot-detail’, when user clicks on the button with the text ‘Book’ 3 times (except the button)?
  1. Slot ID: 1, Slot Status: Booked
  2. Slot ID: 1, Slot Status: Not Booked
  3. Slot ID: 1
  4. Slot Status: Booked
Comprehension passage - the questions below it refer to this
question figure
Q27MCQ3 marks
Suppose the application is running on ‘http://localhost:8080’. What will be rendered inside the ‘router-view’ of Booking component when user visits the URL ‘http://127.0.0.1:8080/#/’?
  1. Page not Found
  2. Booked Slots
  3. Unbooked Slots
  4. None of these
Q28MCQ3 marks
What will be rendered inside the ‘router-view’ of Booking component when user visits the URL ‘http://127.0.0.1:8080/#/unbooked’?
  1. Page not Found
  2. Booked Slots
  3. Unbooked Slots
  4. None of these
Comprehension passage - the questions below it refer to this
question figure
Q29MCQ4.5 marks
Suppose the application is running on ‘http://localhost:8080’, and a user visits the same URL. What will be rendered inside the div element having ID ‘sort’?
  1. 1917
  2. 19
  3. 17
  4. 1719
Q30MCQ3 marks
Suppose the application is running on ‘http://localhost:8080’, and a user visits the same URL. What will be rendered inside the div element having ID “status”?
  1. 12
  2. 1
  3. 2
  4. None of these
Comprehension passage - the questions below it refer to this
question figure question figure
Q31MCQ4.5 marks
Consider the application is running on ‘http://localhost:8080’. Suppose the user visits the URL ‘http://127.0.0.1:8080/#/slot/true’. What will be rendered by the browser inside the “router-view”?
  1. 1. Slot12. Slot2
  2. 1. Slot22. Slot3
  3. 1. Slot1
  4. 1. Slot2
Q32MCQ4.5 marks
Suppose the user visits the URL ‘http://127.0.0.1:8080/#/slot/true?offset=1’, what will be rendered inside the ‘router-view’?
  1. 1. Slot12. Slot2
  2. 1. Slot22. Slot3
  3. 1. Slot1
  4. 1. Slot2

Answer key

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



Core Topics & Concepts Summary

1. Vue.js & Vuex

Key Concepts:

Key Code Snippets:

// Vuex Store
const store = new Vuex.Store({
  state: { count: 0 },
  mutations: {
    increment(state) { state.count++; }
  }
});

// MapState in Component
computed: {
  ...mapState(['count'])  // Correct (Option A in Q2)
}

// Dynamic Class Binding
<div :class="[isActive ? 'active' : '', 'static-class']"></div>

2. JavaScript (ES6+)

Key Concepts:

Key Outputs:

QuestionOutput Explanation
Q71 2 3 4 5 6 (due to let block-scoping in for loop).
Q10[] (async console.log executes before result is updated).
Q12Boiling Water ... → Making Tea (Promise rejects, .catch logs).
Q15Resolved ["quiz1"] after 10 seconds (interval runs 5 times: 2s × 5 = 10s).
Q18Checkpoint 3 5 → Checkpoint 4 → Checkpoint 6 undefined → Checkpoint 2 5.

3. Web Technologies

Key Concepts:


4. Backend & Scalability

Key Concepts:


5. Security

Key Concepts:


6. Algorithms & Data Structures

Key Concepts:



2. JavaScript Asynchronous Flow

3. Web Storage & Cookies

4. Scaling Strategies

5. Security Concepts

6. Caching Hierarchy