Quiz Space

Modern Application Development II · End Term · 13 Apr 2025 · January 2025 term · Set QDD3

Question 12: Consider the following Vue component: Which of the follo…

Question 12

+3 marksOne correct option

Consider the following Vue component:

javascript
Vue.component('search-component', {
data() {
return {
searchQuery: ''
}
},
watch: {
searchQuery(newQuery, oldQuery) {
this.fetchResults(newQuery)
}
},
methods: {
fetchResults(query) {
// Fetch search results
}
}
})

Which of the following statements is true?

  1. A

    The fetchResults method will be called immediately when the component is created.

  2. B

    The fetchResults method will be called only when searchQuery changes.

  3. C

    The watch property can detect changes even if the new value is the same as the old value.

  4. D

    All of these.

Show answer

Correct answer

  • B

    The fetchResults method will be called only when searchQuery changes.

Question 12 of 32 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 13 Apr 2025, in the January 2025 term (IIT M DIPLOMA AN EXAM QDD3 13 Apr 2025). It carries 3 marks.

More questions from this paper

  1. Q1Which of the following statements is true regarding the "this" keyword in JavaScript?
  2. Q2Which of the following correctly describes the lifecycle of a Vue.js component?
  3. Q3Consider the below JavaScript program. What will be the output of the above program?
  4. Q4What is the main advantage of using JWT over session-based authentication?
  5. Q5Which of the following HTTP methods does SSE use for streaming updates to clients?
  6. Q6How does a webhook differ from an API call?
  7. Q7What is the purpose of CORS in web security?
  8. Q8Consider the below JavaScript program. What will be the output of the above program?
  9. Q9Consider the below JavaScript program. What will be the output of the above program?
  10. Q10Consider the below Vuex store configuration: If the addItemAsync action is dispatched with the item 'Vue', what will be…
  11. Q11Consider the below Vue app. What happens when the user navigates to an undefined route like "/random"?
  12. Q13Which scenario is best suited for a task queue system like Celery or RabbitMQ?
  13. Q14Consider the following JavaScript code. What will be returned when processArray([2, 6, 4, 8, 3]) is called?
  14. Q15Examine the following JavaScript code. What will be returned when processData() is called?
  15. Q16Consider the following JavaScript code. What will be the output of the above code on the browser’s console?
  16. Q17Consider the following JavaScript code. What will happen when a user calls the updateToken method with a new value and …
  17. Q18Consider the below Vuex setup. What is logged to the console immediately after dispatching the action?
  18. Q19Consider the below flask SSE implementation. And the Vue.js frontend: What will happen when a user opens this page?
  19. Q20Consider the following Flask application (server.py) and an HTML file named index.html: server.py index.html The applic…
  20. Q21Consider the following Vue apps in script.js and the index.html file. script.js index.html What will be rendered on the…
  21. Q22Consider the following Vue App and the HTML document given below. index.html script.js What will be the output on the b…
  22. Q23Which of the following is/are the correct usage of “v-for” directive in VueJS?
  23. Q24In a Single Page Application (SPA), what are the benefits of client-side routing over server-side routing?
  24. Q25In an SSE connection, how does the client handle incoming messages?
  25. Q26Consider the following Vue Router configuration: Which URL/URLs would render the NotFound component?
  26. Q27Consider the below Vuex store configuration. And the below Vue component: What will be displayed in the placeholder “{{…
  27. Q28How many times will "Render" be logged in the console when the Vue component below is mounted?
  28. Q29Consider the following flask app implemented with JWT. The application running on http://127.0.0.1:5000 and the user lo…
  29. Q30Consider the following flask app implemented with JWT. The application running on http://127.0.0.1:5000 and the user lo…
  30. Q31What will be rendered on the browser if the application is loaded on the browser for the first time?
  31. Q32What will be rendered on the browser for the given value of localStorage?