Quiz Space

Modern Application Development II · End Term · 24 Dec 2023 · September 2023 term · Set FDD1

Question 18: Consider the following Vue application with markup “inde…

Question 18

+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 = "name" @input = "do_something">
<p> {{age}} </p>
</div>
<script scr = "app.js"></script>

app.js:

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

Suppose you open “index.html” file in a browser, and type the text “IIT Madras” 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

    The app will show an error in the console

  2. B

    Default, Default

  3. C

    IIT, Madras

  4. D

    IIT, IIT

  5. E

    Madras, IIT

  6. F

    None of these

Show answer

Correct answer

  • D

    IIT, IIT

Question 18 of 32 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 24 Dec 2023, in the September 2023 term (IIT M DIPLOMA FN EXAM FDD1 24 Dec 2023). It carries 4.5 marks.

This question was also asked in

More questions from this paper

  1. Q1Which of the following statements is/are correct.
  2. Q2Which of the following is/are correct regarding CDN.
  3. Q3Which of the following statement(s) is/are false regarding javascript language?
  4. Q4Which of the following method(s) can be used to ensure that the displayed state and system state are kept in sync at al…
  5. Q5Figure question
  6. Q6Which of the following statement(s) is/are true regarding webhooks?
  7. Q7Which of the following is correct regarding XSS attacks?
  8. Q8You are trying to build a distributed system with N servers, each of which may need to communicate with any of the othe…
  9. Q9Which of the following statement(s) is/are false regarding long and short polling?
  10. Q10Which of the following statement(s) is/are true regarding caching?
  11. Q11Which of the following statements is true regarding CORS and CSRF?
  12. Q12Consider the following JavaScript code. What will be logged on to console, if executed?
  13. Q13Consider the following JavaScript code. What will be logged on to console, if executed?
  14. Q14Consider the following Vue application with JavaScript “app.js” and markup “index.html” app.js index.html Suppose the a…
  15. Q15Consider the following Vue app with markup “index.html” and JavaScript “app.js” app.js index.html Suppose the applicati…
  16. Q16Consider the following flask application. app.py Suppose the application is running on “http://localhost:5000”. If user…
  17. Q17Consider the below javascript program. What will be the output of the above program, if executed? Also, predict the min…
  18. Q19Fill in code1 \& code2, which can be used in Vuex Store to update the “below_average” state variable with the objects o…
  19. Q20Consider the following JavaScript code. Suppose ‘url’ returns an HTML response for a get request with 200 status code. …
  20. Q21Consider the JavaScript code. Suppose the ‘url’ returns a JSON response with 404 status code. What will be logged on to…
  21. Q22Consider the following JavaScript code. What will be logged on to console, if executed?
  22. Q23app.js
  23. Q24app.js index.html
  24. Q25app.py
  25. Q26Consider the below javascript program. What will be the output of the above program, if executed?
  26. Q27Consider the following Vue application with markup “index.html” and javascript file “app.js”. index.html: app.js:
  27. Q28Consider the below javascript program.
  28. Q29Suppose an attacker embeds a malicious link in an email or website, causing the victim's browser to unknowingly submit …
  29. Q30Consider the below javascript program. What will be the output of the above program, if executed?
  30. Q31Which of the following is/are valid use(s) of “v-for” directive, assuming “obj” is an object having a number of key val…
  31. Q32Which of the following statement(s) is/are true regarding Celery?