Quiz Space

Modern Application Development II · Quiz 2 · 16 Mar 2025 · January 2025 term

Question 7: Consider the below Vue router setup. What will be the beh…

Question 7

+3 marksOne correct option

Consider the below Vue router setup.

javascript
const Product = {
template: `<div><h1>Product {{ $route.params.id }}</h1></div>`
};
const ProductReviews = {
template: `<div><h2>Reviews for Product</h2></div>`
};
const routes = [
{
path: '/products/:id',
component: Product,
children: [
{
path: 'reviews',
component: ProductReviews
}
]
}
];
const router = new VueRouter({
routes
});

What will be the behavior when the user visits “/products/123/reviews”?

  1. A

    The Product component will be displayed with the id 123, and the ProductReviews component will be displayed as a child route.

  2. B

    The Product component will not display anything because the reviews path is incorrectly nested.

  3. C

    Only the ProductReviews component will be displayed, and the Product component will be ignored.

  4. D

    A 404 error will be shown because the /reviews route cannot be accessed as a child route.

Show answer

Correct answer

  • A

    The Product component will be displayed with the id 123, and the ProductReviews component will be displayed as a child route.

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

More questions from this paper

  1. Q1Figure question
  2. Q2Figure question
  3. Q3Figure question
  4. Q4Consider the below javascript program. What will be the output of the above program?
  5. Q5Consider the below javascript program. What will be the output of the above program?
  6. Q6Figure question
  7. Q8Consider the below Vuex setup. What will happen if the user dispatches the “addItemToCart” action to add a new item to …
  8. Q9Consider the following javascript code. When the function is called what will be returned if the server is unreachable?
  9. Q10Consider the following javascript code. What's logged?
  10. Q11Consider the following html with relevant vue cdn links added. If a user clicks rapidly twice (within 500ms), what will…
  11. Q12Consider the following html with relevant vue cdn links added. In the Vue application above, what will be the initial r…
  12. Q13Consider the below javascript program. What will be the output of the above program?
  13. Q14Consider the below Vue router setup. Note: Assume that the API “/api/users/userId” is operational and returns the user’…
  14. Q15Consider the below Vue.js application. What will be the visited pages history when the user navigates between pages and…
  15. Q16Consider the below Vue.js application. What will happen if the user submits the form and reloads the page?