Quiz Space

Modern Application Development II · End Term · 24 Dec 2023 · September 2023 term · Set FDD1

MAD 2 End Term 24 Dec 2023 — Question 23

Question 23

+3 marksOne correct option

app.js

javascript
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)">Increese 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
},
},
})
  1. A

    Success

  2. B

    Failure

  3. C

    NaN

  4. D

    None of these

Show answer

Correct answer

  • B

    Failure

Question 23 of 32 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 24 Dec 2023, in the September 2023 term (IIT M DIPLOMA FN EXAM FDD1 24 Dec 2023). It carries 3 marks.

More questions from this paper

  1. Q1Which of the following statements is/are correct.
  2. Q2Which of the following is/are correct regarding CDN.
  3. Q3Which of the following statement(s) is/are false regarding javascript language?
  4. Q4Which of the following method(s) can be used to ensure that the displayed state and system state are kept in sync at al…
  5. Q5Figure question
  6. Q6Which of the following statement(s) is/are true regarding webhooks?
  7. Q7Which of the following is correct regarding XSS attacks?
  8. Q8You are trying to build a distributed system with N servers, each of which may need to communicate with any of the othe…
  9. Q9Which of the following statement(s) is/are false regarding long and short polling?
  10. Q10Which of the following statement(s) is/are true regarding caching?
  11. Q11Which of the following statements is true regarding CORS and CSRF?
  12. Q12Consider the following JavaScript code. What will be logged on to console, if executed?
  13. Q13Consider the following JavaScript code. What will be logged on to console, if executed?
  14. Q14Consider the following Vue application with JavaScript “app.js” and markup “index.html” app.js index.html Suppose the a…
  15. Q15Consider the following Vue app with markup “index.html” and JavaScript “app.js” app.js index.html Suppose the applicati…
  16. Q16Consider the following flask application. app.py Suppose the application is running on “http://localhost:5000”. If user…
  17. Q17Consider the below javascript program. What will be the output of the above program, if executed? Also, predict the min…
  18. Q18Consider the following Vue application with markup “index.html” and javascript file “app.js”. index.html: app.js: Suppo…
  19. Q19Fill in code1 \& code2, which can be used in Vuex Store to update the “below_average” state variable with the objects o…
  20. Q20Consider the following JavaScript code. Suppose ‘url’ returns an HTML response for a get request with 200 status code. …
  21. Q21Consider the JavaScript code. Suppose the ‘url’ returns a JSON response with 404 status code. What will be logged on to…
  22. Q22Consider the following JavaScript code. What will be logged on to console, if executed?
  23. Q24app.js index.html
  24. Q25app.py
  25. Q26Consider the below javascript program. What will be the output of the above program, if executed?
  26. Q27Consider the following Vue application with markup “index.html” and javascript file “app.js”. index.html: app.js:
  27. Q28Consider the below javascript program.
  28. Q29Suppose an attacker embeds a malicious link in an email or website, causing the victim's browser to unknowingly submit …
  29. Q30Consider the below javascript program. What will be the output of the above program, if executed?
  30. Q31Which of the following is/are valid use(s) of “v-for” directive, assuming “obj” is an object having a number of key val…
  31. Q32Which of the following statement(s) is/are true regarding Celery?