Quiz Space

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

Question 8: Consider the following Vue application with markup “index…

Question 8

+4.5 marksOne correct option

Consider the following Vue application with markup “index.html” and JavaScript file “app.js”.

index.html:

html
<div id = "app">
<input v-model = "course" @input = "do_something">
<p> {{role}} </p>
</div>

app.js:

javascript
new Vue({
el : "#app",
data : {
course : "#app",
role : "user",
},
mounted () {
try {
this.course = localStorage.getItem("course").split(" ")[0];
this.role = localStorage.getItem("course").split(" ")[1];
localStorage.setItem("course",
localStorage.getItem("course").split(" ")[0] + " " +
this.course);
}
catch {
this.course = "MAD_II";
this.role = "admin";
}
},
methods : {
do_something() {
localStorage.setItem("course", this.course);
localStorage.setItem("role", this.role);
}
}
})

Suppose you open “index.html” file in a browser, and type the text “App Dev” in the text box shown (after removing the previous text, if any), and hard refresh the page twice, without clicking anywhere. What will be the value shown in the text box, and the “age” placeholder, respectively?

  1. A

    MAD_II, admin

  2. B

    App, Dev

  3. C

    App, App

  4. D

    Dev, App

Show answer

Correct answer

  • C

    App, App

Question 8 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. Q9Which of the following statement(s) is/are correct regarding web storage APIs?
  9. Q10Which of the following is a valid function signature for an action function in Vuex?
  10. Q11Select the statements that incorrectly describe characteristics or practices related to RESTful APIs.
  11. Q12Which of the following statement(s) is/are true regarding Single Page Applications (SPA) and Progressive Web Apps (PWA)?
  12. Q13Identify the correct statement(s) about the behavior of promise chains in JavaScript.
  13. Q14Consider the below Vue class binding. Script.js: Code 1: Code 2: Which of the following statements is/are true, assumin…
  14. Q15Consider the below Vue component template and script definitions that use Vue router. Template: Script: Assuming that t…
  15. Q16Consider the below application with markup “index.html” and JavaScript file “app.js”. Filename: index.html Filename: ap…