MAD Study Hub

Home / Past papers / MAD2 End Term / this paper

IIT M IMPROVEMENT AN EXAM ADI4 24 Dec 2023 - 24 Dec 2023

MAD2 End Term32 questions100 marks19 MCQ · 13 MSQImprovement / afternoon
Elapsed 00:00
Q1MSQ2 marksselect all that apply
Which of the following statements is/are false.
  1. SMTP is a mail delivery protocol.
  2. SMTP is a protocol to retrieve email from an email server.
  3. IMAP is a mail delivery protocol.
  4. IMAP is a protocol to retrieve email from an email server.
Q2MSQ2 marksselect all that apply
Which of the following is/are correct regarding CDN.
  1. CDN is an acronym for Content Delivery Network.
  2. CDN is a group of servers that helps in fast delivery of web contents.
  3. Web content is always delivered from the closest server to the client in thenetwork.
  4. None of these.
Q3MSQ2 marksselect all that apply
Which of the following is correct regarding Celery?
  1. Celery is a task queue.
  2. It needs broker to function.
  3. Celery can be used to schedule the task.
  4. None of these.
Q4MSQ2 marksselect all that apply
Which of the following statement(s) is/are true regarding javascript language?
  1. Replit.com is an example of a javascript engine.
  2. The language supports the concept of first class functions.
  3. The language does not allow the implementation of user defined higher orderfunctions.
  4. The language can be used for DOM manipulation.
Q5MSQ2 marksselect all that apply
Which of the following method(s) does not guarantee that the displayed state and system state are kept in sync at all times?
  1. Ajax requests on each UI change
  2. Periodic reloading of web-page
  3. Vue bindings to update data reactively
  4. Pure static pages with all updates rendered from server
Q6MSQ2 marksselect all that apply
You are trying to build a distributed system with N servers, each of which may need to communicate with any of the other servers. Which of the following statement(s) is/are false?
  1. With point-to-point communication, the number of connection links will growas O(n).
  2. With point-to-point communication, the number of connection links will growas O(n2).
  3. With the use of a central message broker, the number of connection links willgrow as O(n).
  4. With the use of a central message broker, the number of connection links willgrow as O(n2).
Q7MSQ2 marksselect all that apply
Which of the following statement(s) is/are false regarding webhooks?
  1. A webhook uses HTTP protocol.
  2. A webhook uses web socket protocol.
  3. A webhook receiver must be deployed on the same origin as the webhookinitiator.
  4. A webhook is supposed to be used for machine to machine communication
Q8MSQ3 marksselect all that apply
Which of the following is correct regarding XSS attacks?
  1. XSS attack is an exploit where an attacker attaches a malicious code into awebsite.
  2. XSS can be used to steal the user's cookie.
  3. XSS is a client side injection attack.
  4. It can be avoided by validating the user's input.
Q9MSQ3 marksselect all that apply
Which of the following is/are valid use(s) of “v-for” directive, assuming “obj” is an object having a number of key value pairs?
  1. v-for = “value in obj”
  2. v-for = “(value, name) in obj”
  3. v-for = “(value, name, index) in obj”
  4. None of these
Q10MSQ3 marksselect all that apply
question figure
Text of the picture (copyable)
Suppose an application is loaded from an origin "https://abc.com". Which of the following origins will result in a CORS error, while making a fetch call, by default?
  1. question figure
    text
    https://abc.com
  2. question figure
    text
    https://xyz.abc.com
  3. question figure
    text
    https://abc.com/page
  4. question figure
    text
    https://abc8.com
Q11MSQ3 marksselect all that apply
Which of the following statement(s) is/are false regarding long and short polling?
  1. A webhook is the same as short polling.
  2. The short polling can be used to know the state of an asynchronous task, andtrigger an action if the task gets completed.
  3. The long polling cannot be achieved using HTTP protocol.
  4. Long Polling can be used to achieve real time communication
Q12MSQ3 marksselect all that apply
Which of the following statement(s) is/are false regarding caching?
  1. It is recommended to cache the social networking apps feed responses for alonger duration.
  2. Caching is primarily done to reduce the load from the origin server.
  3. The shared cache is meant to serve responses to the multiple users.
  4. A browser cannot cache JavaScript corresponding to a web page.
Q13MSQ3 marksselect all that apply
Which of the following statements is true regarding CORS and CSRF?
  1. CORS stands for Cross Origin Resource Sharing.
  2. The CORS reduces chances of malicious code by explicitly saying which URLscan be originators of data.
  3. CSRF stands for Cross Site Request Forgery.
  4. None of these
Q14MCQ2 marks
Which of the following statement(s) is/are true regarding Celery?
  1. A celery system may consist of multiple brokers.
  2. Redis must be used as a message broker for Celery.
  3. The framework does not support periodic scheduling of tasks.
  4. All of these.
Q15MCQ3 marks
Consider the following JavaScript code. question figure Consider the following JavaScript code.
Text of the picture (copyable)
```javascript
function goUpDown(num) {
  return new Promise((res, rej) => {
    setTimeout(() => {
      if (num < 20) {
        return num > 10 ? res('Go Up') : res('Go Down')
      } else {
        return rej('Number Too Large')
      }
    }, 1000)
  })
}

async function getData() {
  const data3 = await goUpDown(8)
  const data2 = await goUpDown(15)
  const data1 = await goUpDown(12)
}

getData().then(
  (data) => {
    console.log(data)
  },
  (err) => {
    console.log(err)
  }
)
```

What will be logged on to console, if executed?
  1. Go Up
  2. Go Down
  3. Number Too Large
  4. None of these.
Q16MCQ3 marks
Consider the following JavaScript code. question figure Consider the following JavaScript code. Suppose there is an network error and fetch request to the ‘url’ fails. What will be logged on to console, if the code is executed?
Text of the picture (copyable)
```javascript
async function getResponse(url) {
  try {
    const response = await fetch(url)
    try {
      const data = await response.json()
      if (response.ok) {
        return data
      } else {
        return response.status
      }
    } catch {
      return 'Network Error'
    }
  } catch {
    return 'Response is not json'
  }
}

getResponse('url').then((data) => {
  console.log(data)
})
```
  1. Response is not json
  2. Network Error
  3. 200
  4. None of these.
Q17MCQ3 marks
Consider the JavaScript code. question figure Consider the JavaScript code. Suppose the ‘url’ returns a JSON response with 500 status code. What will be logged on to console?
Text of the picture (copyable)
```javascript
async function getResponse(url) {
  try {
    const response = await fetch(url)
    try {
      const data = await response.json()
      if (response.ok) {
        return data
      } else {
        return response.status
      }
    } catch {
      return 'Network Error'
    }
  } catch {
    return 'Response is not json'
  }
}

getResponse('url').then((data) => {
  console.log(data)
})
```
  1. Response is not json
  2. Network Error
  3. 404
  4. 500
Q18MCQ3 marks
Consider the following JavaScript code. question figure Consider the following JavaScript code. What will be logged on to console, if executed?
Text of the picture (copyable)
```javascript
class Tshirt {
  constructor(size, price) {
    this.size = size
    this.price = price
  }
}

class LargeTshirt extends Tshirt {
  constructor() {
    super('large', 500)
  }
}

class MediumTshirt extends Tshirt {
  constructor() {
    super('medium')
  }
}

class Order {
  constructor(item, count) {
    this.item = item
    this.count = count
  }

  totalPrice() {
    try {
      return this.item.price * this.count
    } catch {
      return 'Some Error'
    }
  }
}

const t1 = new MediumTshirt()
const order = new Order(t1, 5)
console.log(order.totalPrice())
```
  1. NaN
  2. 500
  3. 2500
  4. Some Error
Q19MCQ3 marks
Consider the following Vue application with JavaScript “app.js” and markup “index.html” question figure Consider the following Vue application with JavaScript “app.js” and markup “index.html” question figure Consider the following Vue application with JavaScript “app.js” and markup “index.html”
Text of the picture (copyable)
```javascript
app.js
new Vue({
  el: '#app',
  template: `<div>
    <div v-for="item in items">
      Name: {{item.name}},Count:{{item.count}}, Price:
      {{item.price*item.count}}
      <button @click="inscreeseCount (item)">Increase Count</button>
      <button @click="addToCart(item)">Add To Cart</button>
    </div>
    Total Amount: {{amount}} <button @click="buy"> Buy </button>
  </div>`,
  data: {
    cart: [],
    totalAmount: 50,
    items: [
      { name: 'Apple', count: 1, price: 10},
      { name: 'Orange', count: 1, price: 5},
    ],
  },
  methods: {
    buy() {
      if (this.amount > this.totalAmount) {
        console.log('Failure')
      } else {
        console.log('Success')
        this.cart = []
      }
    },
    inscreeseCount (item) {
      item.count += 2
    },
    addToCart (item) {
      this.cart.push(item)
    },
  },
  computed: {
    amount() {
      let total = 0
      this.cart.forEach((item) => {
        total += item.count * item.price
      })
      return total
    },
  },
})
```
index.html
```html
<body>
    <div id="app"></div>
</body>
```

Suppose the application is running on "http://127.0.0.1:8080/". If the user clicks on "Increase Count" and "Add to cart" button associated with the item name "Apple" once. Then user clicks on "Increase Count" and "Add to cart" button associated with the item name "Orange" once and then clicks on the button "Buy". What will be logged on to console?
  1. Success
  2. Failure
  3. NaN
  4. None of these.
Q20MCQ3 marks
Consider the following Vue app with markup “index.html” and JavaScript “app.js” question figure Consider the following Vue app with markup “index.html” and JavaScript “app.js”
Text of the picture (copyable)
app.js
```javascript
const Error = {
    template: `<div>Result Not Found</div>`,
}

const Dashboard = {
    template: `<div> This is dashboard of {{user}}</div>`,
    props: ['user'],
}

const routes = [
    { path: '/dashboard/:user', component: Dashboard, props: true },
    { path: '*', component: Error },
]

const router = new VueRouter({
    routes,
})

new Vue({
    el: '#app',
    template: `<router-view />`,
    router,
})
```

index.html
```html
<body>
    <div id="app"></div>
</body>
```
What will be rendered by the browser for the URL http://127.0.0.1:8080/#/dashboard/7"?
  1. This is dashboard of User
  2. This is dashboard of 7
  3. Dashboard
  4. Result Not Found
Q21MCQ3 marks
Consider the following Vue application with markup “index.html” and JavaScript “app.js” question figure Consider the following Vue application with markup “index.html” and JavaScript “app.js”
Text of the picture (copyable)
app.js
```javascript
const Home = {
  template: `<div>
    <slot name="navbar"> This is navbar</slot>
    <slot></slot>
    <slot name="footer"></slot>
  </div>`,
}

new Vue({
  el: '#app',
  template: `<Home>
    <template slot="footer">This is Footer</template>
    <template slot="navbar"> This is header</template>
    <div>Welcome to exam</div>
  </Home>`,
  components: {
    Home,
  },
})
```

index.html
```html
<body>
  <div id="app"></div>
</body>
```

Suppose the application is running on “http://127.0.0.1:8080/”. What will be rendered by the browser for the URL “http://127.0.0.1:8080/”?
  1. question figure
    text
    This is Footer
    This is Header
  2. question figure
    text
    This is Footer
    This is Header
    Welcome to exam
  3. question figure
    text
    This is Header
    This is Footer
  4. question figure
    text
    This is Header
    Welcome to Exam
    This is Footer
Q22MCQ3 marks
Consider the following flask application. question figure Consider the following flask application.
Text of the picture (copyable)
app.py
```python
from flask import Flask
from flask_caching import Cache
from time import sleep

config = {
    "CACHE_TYPE": "RedisCache",
    "CACHE_REDIS_HOST": "localhost",
    "CACHE_REDIS_PORT": 6379,
    "CACHE_REDIS_DB": 1
}

app = Flask(__name__)
app.config.from_mapping(config)
cache = Cache(app)

@app.get('/')
@cache.cached(timeout=40)
def home():
    sleep(30)
    return "hello world"

if __name__ == "__main__":
    app.run(debug=True)
```
Suppose the application is running on "http://localhost:5000". If user1
visits the URL "http://localhost:5000" and after 3 minutes user2 visits the same URL.
What will be the approx difference between the response time for user1 and user2?
  1. 0 seconds
  2. 30 seconds
  3. 120 seconds
  4. None of these
Q23MCQ3 marks
question figure
Text of the picture (copyable)
Consider the below javascript program.

```javascript
for (var i = 0; i < 3; i++) {
    setTimeout(() => console.log(i), (i+1)*1000);
}
```

What will be the output of the above program, if executed? Also, predict the minimum number of seconds the program will take to complete the execution?
  1. question figure
    text
    0
    1
    2
    Minimum Time Taken: 6 seconds
  2. question figure
    text
    0
    1
    2
    Minimum Time Taken: 12 seconds
  3. question figure
    text
    3
    3
    3
    Minimum Time Taken: 12 seconds
  4. question figure
    text
    3
    3
    3
    Minimum Time Taken: 6 seconds
Q24MCQ3 marks
Consider the below javascript program. question figure Consider the below javascript program. What will be the output of the above program, if executed?
Text of the picture (copyable)
```javascript
async function func() {
  const num = await Promise.resolve(2);
  console.log("Second");
  return num;
}

console.log("First");
func().then((data) => console.log(data));
console.log("Third");
```
  1. question figure
    text
    First
    Second
    Third
    2
  2. question figure
    text
    First
    Error
  3. question figure
    text
    First
    Third
    Second
    undefined
  4. question figure
    text
    First
    Third
    Second
    2
  5. question figure
    text
    The output cannot be predicted
Q25MCQ4.5 marks
Consider the following JavaScript code. question figure Consider the following JavaScript code. What will be logged on to console, if executed?
Text of the picture (copyable)
```javascript
class TShirt {
  constructor(size, price) {
    this.size = size
    this.price = price
  }
}

class LargeTShirt extends TShirt {
  constructor() {
    super('large', 500)
  }
}

class MediumTShirt extends TShirt {
  constructor() {
    super('medium')
  }
}

class Order {
  constructor(item, count) {
    this.item = item
    this.count = count
  }

  totalPrice() {
    try {
      return this.item.price * this.count * 2
    } catch {
      return 'Some Error'
    }
  }
}

const tl = new LargeTShirt()
const order = new Order(tl, 5)
console.log(order.totalPrice())
```
  1. NaN
  2. 500
  3. 2500
  4. 5000
Q26MCQ4.5 marks
Consider the following Vue application with JavaScript “app.js” and markup “index.html” question figure Consider the following Vue application with JavaScript “app.js” and markup “index.html” question figure Consider the following Vue application with JavaScript “app.js” and markup “index.html”
Text of the picture (copyable)
```javascript
app.js
new Vue({
  el: '#app',
  template: `<div>
    <div v-for="item in items">
      Name:{{item.name}},Count:{{item.count}}, Price:
      {{item.price*item.count}}
      <button @click="inscreeseCount(item)">Increase Count</button>
      <button @click="addToCart(item)">Add To Cart</button>
    </div>
    Total Amount: {{amount}} <button @click="buy"> Buy </button>
  </div>`,
  data: {
    cart: [],
    totalAmount: 50,
    items: [
      { name: 'Apple', count: 1, price: 10},
      { name: 'Orange', count: 1, price: 5},
    ],
  },
  methods: {
    buy() {
      if (this.amount > this.totalAmount) {
        console.log('Failure')
      } else {
        console.log('Success')
        this.cart = []
      }
    },
    inscreeseCount(item) {
      item.count += 2
    },
    addToCart(item) {
      this.cart.push(item)
    },
  },
  computed: {
    amount() {
      let total = 0
      this.cart.forEach((item) => {
        total += item.count * item.price
      })
      return total
    },
  },
})
```
index.html
```html
<body>
    <div id="app"></div>
</body>
```

Suppose the application is running on "http://127.0.0.1:8080". Suppose the user clicks on "Increase Count" button associated with the item name "Apple" 5 times and then clicks on "Increase Count" button associated with the item name "Orange" once and then clicks on the button "Buy". What will be logged on to console?
  1. Success
  2. Failure
  3. NaN
  4. None of these.
Q27MCQ4.5 marks
Consider the following Vue app with markup “index.html” and JavaScript “app.js” question figure Consider the following Vue app with markup “index.html” and JavaScript “app.js”
Text of the picture (copyable)
app.js
```javascript
const Error = {
  template: `<div>Result Not Found</div>`,
}

const Dashboard = {
  template: `<div> This is dashboard of {{user}}</div>`,
  props: ['user'],
}

const routes = [
  { path: '/dashboard/:user', component: Dashboard, props: true },
  { path: '*', component: Error },
]

const router = new VueRouter({
  routes,
})

new Vue({
  el: '#app',
  template: `<router-view />`,
  router,
})
```

index.html
```html
<body>
  <div id="app"></div>
</body>
```

Suppose the application is running on “http://127.0.0.1:8080/”. What will be rendered by the browser for “http://127.0.0.1:8080/#/user”?
  1. This is dashboard of User
  2. Dashboard
  3. Error
  4. Result Not Found
Q28MCQ4.5 marks
Consider the following flask application. question figure Consider the following flask application.
Text of the picture (copyable)
app.py
```python
from flask import Flask
from flask_caching import Cache
from time import sleep

config = {
    "CACHE_TYPE": "RedisCache",
    "CACHE_REDIS_HOST": "localhost",
    "CACHE_REDIS_PORT": 6379,
    "CACHE_REDIS_DB": 1
}

app = Flask(__name__)
app.config.from_mapping(config)
cache = Cache(app)

@app.get('/')
@cache.cached(timeout=40)
def home():
    sleep(30)
    return "hello world"

if __name__ == "__main__":
    app.run(debug=True)
```
Suppose the application is running on "http://localhost:5000". If user1 visits the URL "http://localhost:5000" and after 50 seconds user2 visits the same URL. What will be the approx difference between the response time for user1 and user2?
  1. 0 seconds
  2. 30 seconds
  3. 120 seconds
  4. None of these
Q29MCQ4.5 marks
Consider the below javascript program. question figure Consider the below javascript program. What will be the output of the above program, if executed?
Text of the picture (copyable)
```javascript
var first = 1;
obj1 = {
    'first' : 2,
    'second' : function some () {
        console.log(this.first);
    }
}
obj2 = {
    'first' : 3,
    'second' : () => {
        console.log("Function Invoked !!");
        this.second();
    }
}
obj2.second();
```
  1. question figure
    text
    Function Invoked !!
    2
  2. question figure
    text
    Function Invoked !!
    3
  3. question figure
    text
    Function Invoked !!
    1
  4. question figure
    text
    Function Invoked !!
    Error
  5. question figure
    text
    Error
Q30MCQ4.5 marks
Consider the below javascript program. question figure Consider the below javascript program. What will be the output of the above program, if executed? Also, predict the minimum number of seconds the program will take to complete the execution?
Text of the picture (copyable)
```javascript
exams = ['Jan 2023', 'May 2023', 'Sep 2023']

new Promise((rej, res) => {
    let count = 2
    let a = setInterval(() => {
        count += 3;
        const last = exams.pop();
        if (count % 2) {
            exams.push('May 2023')
        }

        else if (count % 5 == 0) {
            clearInterval(a);
            rej(last);
        }
    }, 1000)
}).then(d => console.log("Resolved", exams, d))
  .catch(e => console.log("Rejected", exams, d))
```
  1. question figure
    text
    Resolved []
    Minimum Time Taken: 6 seconds
  2. question figure
    text
    Resolved [] May 2023
    Minimum Time Taken: 12 seconds
  3. question figure
    text
    Rejected [May 2023] May 2023
    Minimum Time Taken: 6 seconds
  4. question figure
    text
    Resolved [] May 2023
    Minimum Time Taken: 6 seconds
  5. question figure
    text
    Rejected [May 2023]
    Minimum Time Taken: 12 seconds
  6. question figure
    text
    Rejected [] May 2023
    Minimum Time Taken: 12 seconds
Q31MCQ4.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 “IIT Madras” in the text box shown (after removing the previous text, if any), and hard refresh the page twice, without clicking anywhere. What will be the value shown in the text box, and the “age” placeholder, respectively?
Text of the picture (copyable)
index.html:

```html
<div id = "app">
  <input v-model = "name" @input = "do_something">
  <p> {{age}} </p>
</div>
<script scr = "app.js"></script>
```

app.js:

```javascript
new Vue({
  el : "#app",
  data : {
    name : "#app",
    age : 0,
  },

  mounted () {
    try {
      this.name = localStorage.getItem("name").split(" ")[0];
      this.age = localStorage.getItem("name").split(" ")[1];
      localStorage.setItem("name",
        localStorage.getItem("name").split(" ")[0] + " " + this.name);
    }
    catch {
      this.name = "Default";
      this.age = "Default";
    }
  },

  methods : {
    do_something() {
      localStorage.setItem("name", this.name);
      localStorage.setItem("age", this.age);
    }
  }
})
```
  1. The app will show an error in the console
  2. Default, Default
  3. IIT, Madras
  4. IIT, IIT
  5. Madras, IIT
  6. None of these
Q32MCQ4.5 marks
Fill in code1 & code2, which can be used in Vuex Store to update the “below_average” state variable with the objects of those students who have scored more than 50 marks. question figure Fill in code1 & code2, which can be used in Vuex Store to update the “below_average” state variable with the objects of those students who have scored more than 50 marks.
Text of the picture (copyable)
```javascript
const store= new Vuex.Store({
    state:{
        student_total:0,
        students:[
            {
                name : 'Akshay',
                marks : 52
            },
            {
                name : 'Vishwajeet',
                marks : 78
            },
            {
                name : 'Sonali',
                marks : 43
            }
        ],
        below_average:[]
    },
    code1:{
        belowAverageStudents(state){
            code2
        }
    }
})
```
  1. question figure
    text
    ```
    code1: mutations
    code2: students.forEach(student=>{
        if(student.marks > 50)
            below_average.push(student)
    })
    ```
  2. question figure
    text
    ```
    code1: actions
    code2: state.students.forEach(student=>{
        if(student.mark > 50)
            below_average.toppers.push(student)
    })
    ```
  3. question figure
    text
    ```
    code1: actions
    code2: context.students.forEach(student=>{
        if(student.marks < 55)
            context.below_average.push(student)
    })
    ```
  4. question figure
    text
    ```
    code1: mutations
    code2: state.students.forEach(student=>{
             if(student.marks > 50)
    
             state.below_average.push(student)
    })
    ```

Answer key

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



Core Topics & Concepts

1. Web Protocols & Communication

2. Distributed Systems & Task Queues

3. Security

4. Caching

5. Frontend Frameworks (Vue.js)

6. JavaScript (ES6+)

7. CDN (Content Delivery Network)

8. Flask (Python Backend)


Key Equations/Code Snippets

TopicEquation/Code
CORS Origin Checkprotocol://domain:port must match (e.g., https://abc.com ≠ https://abc.com:8080).
XSS PreventionDOMPurify.sanitize(userInput) or framework-specific escaping (e.g., Vue’s {{}}).
Celery Task@app.task(bind=True, max_retries=3)
Vuex Mutationstate.below_average = state.students.filter(s => s.marks > 50);
Flask Caching@cache.cached(timeout=40)
JavaScript Closurefor (let i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); }
Async/Await Errortry { await fetch(url); } catch { console.log("Network Error"); }

Exam Tips

  1. JavaScript Closures/Async:

    • var in loops causes closure issues (use let).
    • await pauses execution; errors propagate to the nearest catch.
  2. Vue.js:

    • v-for supports (value, key, index) syntax for objects.
    • Computed properties are cached; methods re-run on re-render.
  3. CORS:

    • Different ports (e.g., :8080 vs. no port) trigger CORS.
    • Subdomains (e.g., xyz.abc.com) are different origins.
  4. Celery:

    • Requires a broker (Redis/RabbitMQ).
    • Supports periodic tasks (e.g., @app.task(run_every=60)).
  5. Caching:

    • Dynamic content (e.g., social feeds) should not be cached long-term.
    • Flask-Caching with Redis: First request is slow; subsequent requests are fast (until timeout).