Quiz Space

Modern Application Development II · End Term · 31 Aug 2025 · May 2025 term · Set QDB1

Question 18: Given the following parent-child component setup: Parent…

Question 18

+3 marksOne correct option

Given the following parent-child component setup:

Parent Component: App.vue

html
<template>
<div>
<h2>Selected Tasks</h2>
<task-list :tasks="tasks" @task-selected="addToSelection" />
<p>Total Selected: {{ selectedTasks.length }}</p>
<ul>
<li v-for="task in selectedTasks" :key="task.id">{{ task.name }}</li>
</ul>
</div>
</template>
<script>
import TaskList from './TaskList.vue';
export default {
components: { TaskList },
data() {
return {
tasks: [
{ id: 1, name: 'Design UI' },
{ id: 2, name: 'Write Backend' },
{ id: 3, name: 'Write Tests' }
],
selectedTasks: []
};
},
methods: {
addToSelection(task) {
const exists = this.selectedTasks.some(t => t.id === task.id);
if (!exists) {
this.selectedTasks.push(task);
}
}
}
};
</script>

Child Component: TaskList.vue

html
<template>
<div>
<h3>All Tasks</h3>
<ul>
<li v-for="task in tasks" :key="task.id">
{{ task.name }}
<button @click="select(task)">Select</button>
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['tasks'],
methods: {
select(task) {
this.$emit('task-selected', task);
}
}
};
</script>

Test Scenario

  1. The app loads.
  2. User clicks "Select" on Design UI and Write Backend in order.
  3. User clicks "Select" on Design UI again.

Based on the above data, answer the given subquestions.

What happens when the user clicks "Select" on Design UI again (step 3)?

  1. A

    It is added again, making the total 3

  2. B

    It replaces the previous task

  3. C

    Nothing changes, no duplicate is added

  4. D

    Vue throws a warning about duplicate keys

Show answer

Correct answer

  • C

    Nothing changes, no duplicate is added

Question 18 of 32 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 31 Aug 2025, in the May 2025 term (IIT M IMPROVEMENT AN EXAM QIB3 31 Aug 2025). It carries 3 marks.

More questions from this paper

  1. Q1In a message queue system, if the consumer is slower than the producer, what is likely to occur first?
  2. Q2Figure question
  3. Q3In Flask, what is the main benefit of using the @cache.cached() decorator?
  4. Q4What is the primary purpose of CORS (Cross-Origin Resource Sharing)?
  5. Q5Which of the following practices help protect against supply chain attacks?
  6. Q6Which of the following factors directly affect the speed and performance of a web page load?
  7. Q7Which of the following is/are the potential benefits of using a message broker?
  8. Q8Which statements about webhooks are correct?
  9. Q9A popular e-commerce platform needs to notify multiple third-party services (inventory management, email marketing, ana…
  10. Q10What is the main advantage of using caching in a Flask-based web application?
  11. Q11What will be the order of console output when the following JavaScript code is executed?
  12. Q12Consider the following Vue application with markup index.html and JavaScript file app.js. File: index.html File: script…
  13. Q13Consider the below JavaScript program. What will be the output of the above program, if executed? Also, predict the min…
  14. Q14Figure question
  15. Q15Consider the following Vue router configuration. If the app loads with userRole = 'user', what will be displayed?
  16. Q16Consider the following JavaScript program: What will be the output of the above program on a browsers console?
  17. Q17Given the following parent-child component setup: Parent Component: App.vue Child Component: TaskList.vue Test Scenario…
  18. Q19Given the following parent-child component setup: Parent Component: App.vue Child Component: TaskList.vue Test Scenario…
  19. Q20Which factors directly impact the Lighthouse "Performance" score?
  20. Q21Which statements are true about handling background tasks in Flask with Celery?
  21. Q22Which of the following are true about mutations and actions in Vuex?
  22. Q23Figure question
  23. Q24Consider the following JavaScript program: What will be the output of the above program?
  24. Q25Consider the following JavaScript code snippet: What will be the output sequence?
  25. Q26What will this Promise chain output?
  26. Q27What happens when this Flask caching code runs? If requests for user IDs 1, 2, 1 are made within 5 minutes, what's the …
  27. Q28What happens when the following code is run in the browser (Vue 2 CDN used)?
  28. Q29What does this async/await code do? If the API returns 404 status, what gets logged?
  29. Q30Consider the following JavaScript program that demonstrates web storage operations: What will be the output of the abov…
  30. Q31Consider the following Flask application configuration for Flask-Security with the User and Role models properly define…
  31. Q32Consider the following endpoints created with a working set up of flask-security and flask-sqlalchemy. Three requests a…