Quiz Space

Modern Application Development II · Quiz 1 · 25 Feb 2024 · January 2024 term

Question 5: Consider the following Vue application with markup index.…

Question 5

+3 marksOne correct option

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

index.html

html
<body>
<div id="app"></div>
<script
src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="./app.js"></script>
</body>

app.js

javascript
new Vue({
el: '#app',
template: `
<div>
{{text}}
<div>
<input type="text" v-model="userInput" />
<div id="match">
{{hasMatched?"Not Matched":"Matched"}}
</div>
</div>
</div>`,
data: {
text: 'This is text',
userInput: null,
},
computed: {
hasMatched() {
return this.text.startsWith(this.userInput)
},
},
})

Suppose the application is running on “http://localhost:8080/”. If the User inputs “This” in the input box. What will be rendered inside the div with id “match”?

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

Correct answer

  • A

Question 5 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 1 paper sat on 25 Feb 2024, in the January 2024 term (IIT M DIPLOMA AN2 EXAM QDD2 25 Feb 2024). It carries 3 marks.

More questions from this paper

  1. Q1Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  2. Q2Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  3. Q3Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  4. Q4Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  5. Q6Consider the following Vue application with markup index.html and JavaScript app.js index.html app.js Suppose the appli…
  6. Q7Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  7. Q8Consider the following JavaScript code. What will be logged on to the console once the code is executed?
  8. Q9Which of the following statement(s) is/are true regarding JavaScript language?
  9. Q10Consider the below JavaScript program. What will be the output of the above program, if executed?
  10. Q11Which of the following is/are example(s) of application state (i.e., system as seen by an individual user)?
  11. Q12Which of the following statement(s) is/are true?
  12. Q13Which of the following is a valid function definition to return the sum of 2 numbers passed as parameter?
  13. Q14Consider the below JavaScript program. What will be the output of the above program, if executed?
  14. Q15Which of the following is not a valid Vue directive?
  15. Q16Consider the below javascript program. What will be the output of the above program, if executed?