Quiz Space

Modern Application Development II · Quiz 2 · 24 Mar 2024 · January 2024 term

Question 15: Consider the below Vue component template and script def…

Question 15

+4.5 marksOne or more correct options

Consider the below Vue component template and script definitions that use Vue router.

Template:

html
<template>
<div>
<h1>{{ pageTitle }}</h1>
<router-link to="/home" v-if="showHomeLink">Home</router-link>
<router-link to="/about" v-if="showAboutLink">About</router-link>
<router-view></router-view>
</div>
</template>

Script:

html
<script>
export default {
name: 'App',
data() {
return {
pageTitle: 'Vue Router Demo',
showHomeLink: true,
showAboutLink: false,
};
},
watch: {
'$route.path'() {
if (this.$route.path === '/home') {
this.showAboutLink = true;
this.showHomeLink = false;
this.pageTitle = 'Home Page';
} else if (this.$route.path === '/about') {
this.showAboutLink = false;
this.showHomeLink = true;
this.pageTitle = 'About Page';
} else {
this.pageTitle = 'Vue Router Demo';
}
},
},
};
</script>

Assuming that the corresponding routes are properly configured, what does this component structure accomplish?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • B
  • D

Question 15 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 24 Mar 2024, in the January 2024 term (IIT M DIPLOMA AN EXAM QDD2 24 Mar 2024). It carries 4.5 marks.

More questions from this paper

  1. Q1Consider the below javascript program. What will be the output of the program, if executed in a REPL environment?
  2. Q2Consider the below JavaScript code. What will be the output of the above program, assuming the value of the variable “s…
  3. Q3Consider the below JavaScript program. What will be the output of the above program, if executed?
  4. Q4Consider the following Script embedded in an HTML document. What will be the output on console, if the HTML document is…
  5. Q5Fill in property_name & definition, which can be used in Vuex Store to update the “best_food” state variable with the o…
  6. Q6Consider the following JavaScript code snippet. What will be the values of 'storedUsername', 'removedUsername', and 'cl…
  7. Q7Consider the below JavaScript program. Considering the asynchronous nature of promises in the above JavaScript program,…
  8. Q8Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: app.js: Suppo…
  9. Q9Which of the following statement(s) is/are correct regarding web storage APIs?
  10. Q10Which of the following is a valid function signature for an action function in Vuex?
  11. Q11Select the statements that incorrectly describe characteristics or practices related to RESTful APIs.
  12. Q12Which of the following statement(s) is/are true regarding Single Page Applications (SPA) and Progressive Web Apps (PWA)?
  13. Q13Identify the correct statement(s) about the behavior of promise chains in JavaScript.
  14. Q14Consider the below Vue class binding. Script.js: Code 1: Code 2: Which of the following statements is/are true, assumin…
  15. Q16Consider the below application with markup “index.html” and JavaScript file “app.js”. Filename: index.html Filename: ap…