MAD Study Hub

Home / Past papers / MAD2 Quiz 1 / this paper

Modern Application Development Ii 15 Mar 26 - 15 Mar 2026

MAD2 Quiz 116 questions50 marks12 MCQ · 3 MSQ · 1 SA
Elapsed 00:00
Q1MSQ2 marksselect all that apply
Which of the following statements about JavaScript scope is/are correct in the browser?
  1. is function-scoped
    text
    var
  2. and are block-scoped
    text
    let
    ```
    const
    ```
  3. Variables declared with are hoisted and initialized with
    text
    let
    undefined
  4. variables can be declared without initialization
    text
    ```
    const
    ```
  5. Global variables are always attached to window (as a property)
Q2MSQ2 marksselect all that apply
Which of the following statements about JavaScript functions is/are true?
  1. Every function in JavaScript is an object.
  2. Arrow functions have their own “this” binding
  3. Function declarations are hoisted.
  4. Function expressions assigned to variables are hoisted with their function value.
Q3MCQ3 marks
Consider the following JavaScript code: question figure What will be printed on the console?
Text of the picture (copyable)
```javascript
var a = 3;
const obj1 = {
  a: 20,
  show: function () {
    console.log(this.a);
  }
};
const obj2 = { a: 10 };

obj1.show.apply(obj1);
```
  1. 20
  2. 10
  3. undefined
  4. 3
Q4MCQ3 marks
Consider the following JavaScript code: question figure The above code is initially loaded in the browser, and then the browser is refreshed two times. What will be the final output printed in the console?
Text of the picture (copyable)
```javascript
function addItemToCart(item) {
    let cart = JSON.parse(localStorage.getItem('cart')) || [];
    cart.push(item);
    localStorage.setItem('cart', JSON.stringify(cart));
}

function getCartItems() {
    return localStorage.getItem('cart') || [];
}

addItemToCart({ id: 1, name: 'Laptop' }.name);

console.log(getCartItems());
```
  1. text
    ```
    []
    ```
  2. text
    ```
    ['Laptop', 'Laptop', 'Laptop']
    ```
  3. text
    ```
    [{ id: 1, name: 'Laptop' }]
    ```
  4. text
    [undefined]
Q5MCQ3 marks
Match the following storage mechanisms used in the browser with their correct characteristics. question figure Which of the following is the correct matching?
Text of the picture (copyable)
| Storage Type      | Characteristic                                                                    |
| :---------------- | :-------------------------------------------------------------------------------- |
| 1. Session Storage | A. Data automatically encrypts itself without developer intervention.             |
| 2. Token Storage   | B. Data persists only until the browser/tab is closed.                            |
| 3. Cookie Storage  | C. Often used to store authentication tokens securely on the client side.         |
|                   | D. Data persists across sessions, typically stored on the client and sent with every HTTP request. |
  1. 1 → B, 2 → C, 3 → A
  2. 1 → B, 2 → A, 3 → C
  3. 1 → A, 2 → C, 3 → B
  4. 1 → B, 2 → C, 3 → D
Q6MCQ3 marks
Consider the following Vue application with markup index.html and javascript file app.js. index.html: question figure app.js: question figure What will be rendered by the browser after 4 seconds?
Text of the picture (copyable)
```html
<div id="app">
    <h4>total payable amount is {{totalPayableAmount}}</h4>
</div>
<script src = "app.js"></script>
```
```javascript
const app = new Vue({
  el: '#app',
  data: {
    principal: 0,
    annualInterestRate: 0,
    duration: 0,
    totalPayableAmount: 0,
  },
  computed: {
    simpleInterest() {
      return (this.principal * this.annualInterestRate * this.duration) /
        100
    },
  },
})

let appData = [
  [2000, 10, 2],
  [3000, 20, 3],
  [5000, 30, 4],
]

let handler = setInterval(() => {
  data = appData.pop()
  app.principal = data[0]
  app.annualInterestRate = data[1]
  app.duration = data[2]
  app.totalPayableAmount += app.simpleInterest
}, 1000)
```
  1. total payable amount is 6000
  2. total payable amount is 8200
  3. total payable amount is 1800
  4. total payable amount is 7800
Q7MCQ3 marks
What will be the output of the following program ? question figure
Text of the picture (copyable)
```javascript
const course = {
  courseName: 'Modern Application Development 2',
  courseCode: 'mad2',
}
const student = {
  __proto__: course,
  studentName: 'Rakesh',
  studentCity: 'Delhi',
}
const { courseName } = student
console.log(courseName)
```
  1. Undefined
  2. Modern Application Development 2
  3. Will throw syntax error
  4. None of these
Q8SA3 marks
Consider the following JavaScript code snippet: question figure What is the final value of x, logged on the console?
Text of the picture (copyable)
```javascript
let x = 2;
function op(x) {
  x *= 3;
  x += 4;
  x -= 1;
}
op();
op();
console.log(x);
```
Q9MCQ2 marks
Which of the following best describes UI State (Ephemeral State) in frontend applications?
  1. It includes all data stored permanently in the database and is shared across users
  2. It represents the complete system data such as users, products, and transactions
  3. It refers to short-lived interface elements like loading indicators or selected tabs
  4. It handles complex application logic and long-term session management
Q10MCQ2 marks
Given that HTTP is stateless, which approach is commonly used to manage application state between the client and the server?
  1. Storing all state permanently in frontend memory across sessions
  2. Allowing the frontend to handle complex business logic and data storage
  3. Client or server maintaining state and explicitly exchanging it through requests
  4. Eliminating state entirely from web applications
Q11MCQ4 marks
Consider the below Javascript function: question figure What will be the output of the above program ?
Text of the picture (copyable)
```javascript
function outer() {
  let count = 0;
  return function inner() {
    return count++;
  };
}

const c1 = outer();
const c2 = outer();

console.log(c1())
console.log(c1())
console.log(c2())
```
  1. 1 2 1
  2. 0 0 0
  3. 1 2 3
  4. 0 1 0
Q12MCQ5 marks
Consider the following Vue app with html and javascript file given below: File: index.html question figure File: script.js question figure What will be rendered on the browser for the code setup given above ?
Text of the picture (copyable)
```html
<div id="app">
  <my-comp>
    <h3>Exploring Vue Js</h3>

    <slot v-slot:last>
      <h3>Learning App Dev 2</h3>
    </slot>
  </my-comp>
</div>
```
```javascript
const MyComp = {
  name: 'my-comp',
  props: ['tech'],
  template: `
    <div class="container">
      <slot name="complete">
        <h3>Learned DBMS</h3>
      </slot>

      <slot>
        Exploring Frontend
      </slot>

      <slot name="last"></slot>
    </div>
  `
};

const app = new Vue({
  el: '#app',
  components: {
    MyComp
  }
});
```
  1. question figure
    text
    Learned DBMS
    Exploring Backend
  2. question figure
    text
    Learned DBMS
    
    Exploring Vue Js
    
    This is Last Course
  3. question figure
    text
    Learned DBMS
    Exploring Vue Js
  4. None of these.
Q13MCQ5 marks
Consider the following JavaScript code: question figure What would be the end result at the end of execution of the code?
Text of the picture (copyable)
```javascript
function createCounter(start) {
  let count = start;

  return function (step) {
    if (typeof step === "number") {
      count += step;
      return count;
    }
  }

  return (function () {
    let temp = count;

    return function (reset = false) {
      if (reset) {
        count = start;
      } else {
        count++;
      }
      return temp + count;
    };
  })();
}

const counter = createCounter(3);

let a = counter(2);
let d = counter()(true);

a + d;
```
  1. 5
  2. 13
  3. 8
  4. 11
Q14MSQ4 marksselect all that apply
Consider the following JavaScript code: question figure Which of the following statements are TRUE?
Text of the picture (copyable)
```javascript
class Device {
  constructor(type) {
    this.type = type;
  }

  info() {
    return `${this.type} device`;
  }
}

class Mobile extends Device {
  constructor(type, brand) {
    super(type);
    this.brand = brand;
  }

  info(brand = "type") {
    return `${this.brand} is a ${this.type} device`;
  }
}

let d = new Device("Electronic");
let m = new Mobile("Electronic", "Samsung");

let x = m.info;
```
  1. returns "Electronic device"
    text
    ```
    d.info()
    ```
  2. returns "Samsung is a Electronic device"
    text
    ```
    m.info()
    ```
  3. Calling throws a runtime error
    text
    x()
  4. returns "Electronic device"
    text
    ```
    d.constructor()
    ```
Comprehension passage - the questions below it refer to this
Consider the following HTML and Vue component code carefully and answer the given sub-questions. File: index.html question figure File: script.js question figure
Q15MCQ3 marks
When the lifecycle hook is invoked, which of the following statements becomes TRUE?
Text of the picture (copyable)
```
beforeMount()
```
  1. The element exists in the DOM but still contains {{ message }}
    text
    ```html
    <p id="text">
    ```
  2. The DOM content already reflects the updated value "Start A"
  3. The hook has already executed
    text
    ```
    mounted()
    ```
  4. The DOM does not exist at all
Q16MCQ3 marks
What will be the final text content displayed in the browser inside the element after the component is fully mounted and all statements in the hook have executed?
Text of the picture (copyable)
`<p>`
```
mounted()
```
  1. text
    Start A
  2. text
    Start A B
  3. text
    Start A B DOM
  4. text
    Start A DOM

Answer key

  1. Q1 (MSQ, 2 marks): A, B
  2. Q2 (MSQ, 2 marks): A, C
  3. Q3 (MCQ, 3 marks): A
  4. Q4 (MCQ, 3 marks): B
  5. Q5 (MCQ, 3 marks): D
  6. Q6 (MCQ, 3 marks): B
  7. Q7 (MCQ, 3 marks): B
  8. Q8 (SA, 3 marks): 2
  9. Q9 (MCQ, 2 marks): C
  10. Q10 (MCQ, 2 marks): C
  11. Q11 (MCQ, 4 marks): D
  12. Q12 (MCQ, 5 marks): C
  13. Q13 (MCQ, 5 marks): B
  14. Q14 (MSQ, 4 marks): A, B, C
  15. Q15 (MCQ, 3 marks): A
  16. Q16 (MCQ, 3 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 summary of the core topics, concepts, principles, and equations essential for the exam, followed by a knowledge graph.


Core Topics and Concepts Summary

This exam primarily focuses on JavaScript fundamentals, browser APIs, web application architecture, and the Vue.js framework.


1. JavaScript Fundamentals


2. Browser APIs & Web Development Concepts


3. Vue.js Framework


4. Mathematical Equations

While the exam is primarily software-focused, one question involved a basic financial calculation: