Quiz Space

Modern Application Development II · End Term · 21 Dec 2025 · September 2025 term

Question 14: Consider the following JavaScript code snippet where a w…

Question 14

+3 marksOne correct option

Consider the following JavaScript code snippet where a web application manages user preferences using localStorage. A user opens the application, sets their theme preference to "dark", refreshes the page once, closes the browser tab, and opens a new tab to reload the page. What will be the behavior of the theme preference?

  1. A

    The theme will be lost because closing the browser tab clears localStorage

  2. B

    The theme will be preserved as "dark" because localStorage persists across browser sessions

  3. C

    The theme will be undefined because localStorage is cleared on refresh

  4. D

    The theme will be reset to "light" when a new tab is opened

Show answer

Correct answer

  • B

    The theme will be preserved as "dark" because localStorage persists across browser sessions

Question 14 of 29 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 21 Dec 2025, in the September 2025 term (Modern Application Development Ii 18 Dec 25). It carries 3 marks.

More questions from this paper

  1. Q1Considering the following code snippet, which statements are true about components in Vue?
  2. Q2Consider the following JavaScript code snippet. What will be printed on the console?
  3. Q3Which of the following is considered a good practice for securing user authentication in a web application?
  4. Q4In the following code snippet, which values should replace option1 and option2 so that the cookie is sent only over HTT…
  5. Q5When comparing Redis with a typical API data store (like a relational database accessed through REST APIs), which of th…
  6. Q6How can you stop a Cross-Site Scripting (XSS) attack?
  7. Q7Which of the following describe Redis features correctly?
  8. Q8Which of the following is true about Vuex state?
  9. Q9What is the purpose of Redis in a Celery-based system?
  10. Q10What happens to the fetch call when it gets a 404 status code (page not found)?
  11. Q11Consider the following JavaScript snippet. What will be printed on the browser's console?
  12. Q12Consider the following JavaScript snippet: What will be printed on the browsers' console?
  13. Q13Consider the following Vue Router setup and HTML. Suppose the webpage is served at http://127.0.0.1:5000. A user visits…
  14. Q15A developer creates a Vue component using both v-if and v-show directives on different elements with initially false co…
  15. Q16A Promise chain is created as follows. The first Promise resolves with a string, which is then processed through multip…
  16. Q17A JavaScript object is created and then assigned to another variable. Modifications are made through both variables. Wh…
  17. Q18Which of the following statements about the "this" keyword in JavaScript are correct?
  18. Q19A Vue Router application uses lazy-loaded route components. When a user navigates to a route with a dynamic parameter (…
  19. Q20A developer uses sessionStorage to store authentication tokens in a web application. The user logs in, the token is sto…
  20. Q21A developer creates a Vue component with prototype chain inspection. The component uses class-based inheritance with li…
  21. Q22In a web application using webhooks and Redis for real-time data synchronization:\ Scenario: An order management system…
  22. Q23Consider the Vue application. Based on the above data, answer the given subquestions. What happens when the user clicks…
  23. Q24Consider the Vue application. Based on the above data, answer the given subquestions. Under which condition will the co…
  24. Q25Consider the Vue application. Based on the above data, answer the given subquestions. What are the benefits of computed…
  25. Q26Consider the following Vue 2 (CDN) code. html code: script: Based on the above data, answer the given subquestions. Wha…
  26. Q27Consider the following Vue 2 (CDN) code. html code: script: Based on the above data, answer the given subquestions. Why…
  27. Q28Consider the following Vue.js application with two different route scenarios and a component that uses reactive data bi…
  28. Q29Consider the following Vue.js application with two different route scenarios and a component that uses reactive data bi…