Quiz Space

Modern Application Development II · Quiz 2 · 3 Aug 2025 · May 2025 term

MAD 2 Quiz 2 3 Aug 2025 — Question 15

Question 15

+4.5 marksOne correct option

You are given the following HTML and JavaScript code that uses Vue 2 via CDN along with Vue Router. Read the code carefully and answer the given subquestions.

app.js

javascript
const Home = {
template: `
<div>
<h2>Home Page</h2>
<p v-if="loading">Loading data...</p>
<p v-show="!loading">{{ message }}</p>
<button @click="fetchData">Fetch</button>
</div>
`,
data() {
return {
message: '',
loading: false
};
},
methods: {
async fetchData() {
this.loading = true;
await this.simulateApiCall().then((res) => {
this.message = res;
this.loading = false;
});
},
simulateApiCall() {
return new Promise((resolve) => {
setTimeout(() => resolve("Fetched Data from API!"), 1000);
});
}
}
};
const About = {
template: '<div><h2>About Page</h2></div>'
};
const router = new VueRouter({
routes: [
{ path: '/home', component: Home },
{ path: '/about', component: About }
]
});
new Vue({
el: '#app',
router
});
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 15 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 3 Aug 2025, in the May 2025 term (IIT M DIPLOMA AN EXAM QDD2 03 Aug 2025). It carries 4.5 marks.

More questions from this paper

  1. Q1Suppose a client wants to make a POST request using the Fetch API to a public endpoint at /api/submit, which includes s…
  2. Q2Which of the following statements are true?
  3. Q3Which of the following statement(s) about Web Storage APIs is/are correct?
  4. Q4Which of the following statement(s) is/are true regarding Single Page Applications (SPA) and Progressive Web Apps (PWA)?
  5. Q5Consider the following code snippet. What will be logged to the console?
  6. Q6The following code is using Vue 2 and Vue router 3 running on http://127.0.0.1:5500. Filename: index.html Filename: rou…
  7. Q7Consider the following Vue 2 component defined using the CDN version: Filename: index.html Filename: app.js What will b…
  8. Q8Consider the following JavaScript program: What will be the output of the above program when executed?
  9. Q9Consider the following Vue application with markup "index.html" and JavaScript file "app.js". Filename: index.html File…
  10. Q10Consider the following Vue 2 code with Vuex 3 used via CDN, assume the Vuex store is correctly injected into the Vue in…
  11. Q11Filename: app.js Suppose the application is running on "http://localhost:3000", select the correct option(s)?
  12. Q12The following code is using Vue 2 and Vue router 3 running on http://127.0.0.1:5500. Filename: index.html Filename: rou…
  13. Q13Consider the following Vue application with markup "index.html" and JavaScript file "app.js". Filename: index.html File…
  14. Q14Consider the following Vuex store setup for a user management system: What will happen when the following sequence of o…
  15. Q16Suppose the button is clicked multiple times quickly, the message area flickers unexpectedly. How can you improve the c…