MAD Study Hub

Home / Past papers / MAD2 Quiz 1 / this paper

Modern Application Development Ii 16 Jul 26 - 19 Jul 2026

MAD2 Quiz 116 questions50 marks10 MCQ · 6 MSQ
Elapsed 00:00
Q1MSQ2 marksselect all that apply
Consider running the following in Browser console: question figure Which of the following statements are correct?
Text of the picture (copyable)
```javascript
console.log(typeof setTimeout)
console.log(typeof document)
```
  1. The first line prints .
    text
    "function"
  2. The second line prints .
    text
    "undefined"
  3. will work in Browser by default because V8 provides the DOM.
    text
    ```javascript
    document.querySelector()
    ```
  4. Different runtimes (browser, Node.js, etc.) can provide different APIs even if they use the same JavaScript engine.
Q2MSQ2 marksselect all that apply
Which of the following are advantages of component-based frontend frameworks like Vue.js?
  1. Code reusability
  2. Better maintainability
  3. Automatic SQL query optimization
  4. Easier UI management
Q3MSQ2 marksselect all that apply
Which of the following cases is a function being used as a callback?
  1. question figure
    text
    ```javascript
    items.forEach(item => console.log(item))
    ```
  2. question figure
    text
    ```javascript
    setTimeout(showMessage, 1000)
    ```
  3. text
    ```javascript
    const result = showMessage()
    ```
  4. question figure
    text
    ```javascript
    button.addEventListener("click", handleClick)
    ```
Q4MCQ3 marks
What is the correct output order for the following code? question figure
Text of the picture (copyable)
```javascript
console.log("1")

setTimeout(() => {
  console.log("2")
  setTimeout(() => console.log("3"), 0)
}, 0)

console.log("4")
```
  1. 1 2 3 4
  2. 1 4 2 3
  3. 2 1 4 3
  4. 4 1 2 3
Q5MCQ3 marks
A child component is initially visible using . The parent first updates a prop passed to the child, and then sets . After the child has already mounted once, which sequence can occur in the child after initial render?
Text of the picture (copyable)
```
v-if="show"
```
```
show = false
```
  1. -> -> ->
    text
    beforeUpdate
    updated
    beforeDestroy
    destroyed
  2. -> -> ->
    text
    beforeDestroy
    destroyed
    beforeUpdate
    updated
  3. -> -> ->
    text
    created
    mounted
    beforeUpdate
    destroyed
  4. -> -> ->
    text
    updated
    beforeCreate
    destroyed
    mounted
Q6MCQ3 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
let var1 = 20;
var var2 = 30;
const val = 10;

{
    let var1 = 40;
    console.log(var1 + val);
}

console.log(var1 + val);

{
    var var2 = 50;
    console.log(var2 + val);
}

console.log(var2 + val);
```
  1. 50 50 60 40
  2. 50 50 60 60
  3. 50 30 60 60
  4. 50 30 60 40
Q7MCQ3 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
const obj1 = {
    prop1: "Germany",
    prop2: "Spain",
    prop3: 50,
    method1: function(){
        console.log(`The European countries are ${this.prop2} and ${this.prop1}.`)
    },
    method2: function(param){
        let value = param + 2*this.prop3;
        console.log(`The final numerical value is: ${value}.`)
    }
}

const obj2 = {
    prop1: "England",
    prop2: "Italy",
    prop3: "25"
}

const func1 = obj1.method1;
const func2 = obj1.method2;

func1.apply(obj1);
func2.bind(obj2)(15);
```
  1. The European countries are Spain and Germany. The final numerical value is: 115.
  2. The European countries are Italy and England. The final numerical value is: 65.
  3. The European countries are Spain and Germany. The final numerical value is: 65.
  4. The European countries are Italy and England. The final numerical value is: 115.
Q8MCQ3 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
const obj1 = {
    prop1: "Aluminium",
    prop2: "Gold",
    prop3: "Silver"
}

const obj2 = {
    propA: "Argon",
    propB: "Neon"
}

const {prop2: element1, propA: element2} = {...obj2, ...obj1};

console.log(`The selected elements are: ${element1} and ${element2}`);
```
  1. The selected elements are: Gold and Argon
  2. The selected elements are: Aluminium and Silver
  3. The selected elements are: Argon and Neon
  4. The selected elements are: Gold and Neon
  5. The selected elements are: Argon and Gold
Q9MCQ2 marks
Which of the following Vue directives are correctly matched with their purpose?
  1. v-show → fetching api
  2. v-for → Iteration over lists
  3. v-bind → Conditional rendering
  4. v-model → Event handling only
Q10MSQ3 marksselect all that apply
Given the following parent-child setup in Vue 2: question figure and inside the child: question figure Which statements are correct?
Text of the picture (copyable)
```html
<child-box :message="parentMsg" @reply="handleReply"></child-box>
```
```javascript
this.$emit('reply', 'ok')
```
  1. flows from parent to child through props.
    text
    message
  2. is a custom event sent from child to parent.
    text
    reply
  3. The child should directly change to update the parent source of truth.
    text
    message
  4. If changes in the parent, the child can receive the updated prop value.
    text
    parentMsg
Q11MSQ3 marksselect all that apply
Identify the issue in the following Vue.js code: question figure Why does the value not update correctly when the button is clicked?
Text of the picture (copyable)
```html
<div id="app">
  <p>{{ message }}</p>
  <button @click="changeMessage">Click</button>
</div>

<script>
  new Vue({
    el: '#app',
    data: {
      message: "Hello"
    },
    methods: {
      changeMessage: () => {
        this.message = "Updated"
      }
    }
  })
</script>
```
message
  1. should be used instead of
    text
    v-on
    ```
    @click
    ```
  2. Arrow functions do not bind their own
    text
    this
  3. should be a function in all Vue instances
    text
    data
  4. Vue.js does not support external methods
Q12MSQ3 marksselect all that apply
Consider the following JavaScript code snippet. question figure Which of the following statements is/are correct?
Text of the picture (copyable)
```javascript
class MathUtils {
  static add(a, b) {
    return a + b;
  }
  multiply(a, b) {
    return a * b;
  }
}

const utils = new MathUtils();
```
  1. will work correctly and return 8
    text
    ```
    MathUtils.add(5, 3)
    ```
  2. will work correctly and return 8
    text
    ```
    utils.add(5, 3)
    ```
  3. will work correctly and return 15
    text
    ```
    utils.multiply(5, 3)
    ```
  4. will work correctly and return 15
    text
    ```
    MathUtils.multiply(5, 3)
    ```
Q13MCQ4.5 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
var var1 = 25;
var var2 = 35;

const obj = {
    var1: 45,
    var2: 55,
    func1: function(){
        console.log(`You are accessing: ${var1}`)
    },
    func2: () => {
        console.log(`You are accessing: ${this.var2}`)
    },
}

obj.func1()
obj.func2()
```
  1. You are accessing: 45 You are accessing: 55
  2. You are accessing: 25 You are accessing: 35
  3. You are accessing: 25 You are accessing: 55
  4. You are accessing: 45 You are accessing: 35
Q14MCQ4.5 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console in correct order?
Text of the picture (copyable)
```javascript
console.log(z);
var a = "alpha";
console.log(a);
let b = "beta"
console.log(b);
d();
console.log(c);
const c = "charlie"
function d(){
    console.log("delta")
}
var z = function(){
    console.log("zeta")
}
```
  1. undefined alpha beta delta Reference Error
  2. zeta undefined beta delta Reference Error
  3. undefined Reference Error beta charlie undefined
  4. zeta Reference Error beta charlie undefined
Q15MCQ4.5 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
let myArr = ["January", "March", "April", "August", "September", "October"]

let modArr = myArr.map((m) => m.slice(2)).
    filter((m) => m.length < 5).
    sort();

console.log(modArr[1]);
```
  1. ['gust', 'rch', 'ril']
  2. ['rch', 'ril', 'gust']
  3. ril
  4. rch
Q16MCQ4.5 marks
Consider the following JavaScript code snippet. question figure What will be the output of the above code on the browsers’ console?
Text of the picture (copyable)
```javascript
function first() {
  console.log("First start");
  setTimeout(function () {
    console.log("First timeout");
  }, 0);
  console.log("First end");
}

function second() {
  console.log("Second start");
  setTimeout(function () {
    console.log("Second timeout");
  }, 0);
}

console.log("Program start");
first();
second();
console.log("Program end");
```
  1. Program start First start First timeout First end Second start Second timeout Program end
  2. Program start First start First end First timeout Second start Second timeout Program end
  3. Program start First timeout First start First end Second timeout Second start Program end
  4. Program start First start First end Second start Program end First timeout Second timeout

Answer key

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

The questions provided cover fundamental and advanced concepts in JavaScript and frontend development with Vue.js. No specific mathematical equations were required for solving these questions, but a strong foundation in logical reasoning and problem-solving, which are core to mathematics, is essential for software engineering.

Summary of Core Topics and Concepts

I. JavaScript Fundamentals

II. Frontend Frameworks (Vue.js)

III. Mathematical Equations & Principles

No specific mathematical equations were required for these questions. The relevance of mathematics lies in the underlying logical structures of programming and problem-solving.