Quiz Space

Modern Application Development II · Quiz 2 · 4 Aug 2024 · May 2024 term

Question 14: Analyze the given HTML with embedded script. What will b…

Question 14

+4.5 marksOne correct option

Analyze the given HTML with embedded script.

html
<body>
<div id="status"></div>
<div id="result"></div>
<script>
function updateStatus(message) {
document.getElementById("status").textContent = message;
}
function updateResult(message) {
document.getElementById("result").textContent = message;
}
let promise1 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Data Loaded");
}, 1000);
});
let promise2 = Promise.reject("Network Error");
promise1
.then((result) => {
updateStatus(result);
})
.catch((error) => {
updateResult(error);
});
promise2
.catch((error) => {
updateStatus(error);
return Promise.resolve("Retry Successful");
})
.then((result) => {
updateResult(result);
});
</script>
</body>

What will be the final state of HTML elements, after all the setTimeout() have finished executing.

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

Correct answer

  • C

Question 14 of 16 in the IIT Madras BS Modern Application Development II (MAD 2) Quiz 2 paper sat on 4 Aug 2024, in the May 2024 term (IIT M DIPLOMA AN EXAM QDD2 4 Aug 2024). It carries 4.5 marks.

More questions from this paper

  1. Q1Consider the below JavaScript program. What will be the output of the above program, if executed?
  2. Q2Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: app.js: Suppo…
  3. Q3Consider the following application with markup index.html and script app.js. index.html: app.js: Suppose the applicatio…
  4. Q4Consider the below JavaScript program. What will be the output of the above program?
  5. Q5Consider the following Vue application with markup “index.html” and JavaScript file “app.js”. index.html: app.js: Suppo…
  6. Q6Consider the below JavaScript program, and predict the output, if executed.
  7. Q7Consider the following Vue application with markup index.html and JavaScript file app.js. File: index.html File: script…
  8. Q8Consider the following JavaScript code. What will be the output of the above code snippet on the console of the browser?
  9. Q9Consider the following HTML snippet that uses Vue 2 using CDN in the script.js file Filename: index.html Filename: scri…
  10. Q10Suppose you are organizing a felicitation program for the students with exemplary performance in the BS program. You ha…
  11. Q11Figure question
  12. Q12Which of the following statement(s) is/are incorrect regarding Vuex?
  13. Q13Consider the following HTML, with Vue 2 CDN attached to it. Filename: index.html Filename: script.js What will be logge…
  14. Q15Consider the following HTML document embedded with Vue CDN and the script file shown below. Filename: index.html Filena…
  15. Q16Consider the below Vue component template and script definitions that use Vue router. Vue component template Filename: …