Quiz Space

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

Question 6: Consider the below JavaScript program, and predict the ou…

Question 6

+3 marksOne correct option

Consider the below JavaScript program, and predict the output, if executed.

javascript
async function exam () {
let x = await new Promise((res, rej) => res(2 || 0));
console.log("Statement 1");
let y = await new Promise((res, rej) => res(0 && 2));
console.log("Statement 2", "gives result as", x + y);
}
exam();
console.log("Statement 3");
  1. A

    Statement 3
    Statement 1
    Statement 2 gives result as 4

  2. B

    Statement 3
    Statement 1
    Statement 2 gives result as 2

  3. C

    Statement 3
    Statement 1
    Statement 2 gives result as 0

  4. D

    Statement 1
    Statement 3
    Statement 2 gives result as 4

  5. E

    Statement 1
    Statement 3
    Statement 2 gives result as 2

Show answer

Correct answer

  • B

    Statement 3
    Statement 1
    Statement 2 gives result as 2

Question 6 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 3 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. Q7Consider the following Vue application with markup index.html and JavaScript file app.js. File: index.html File: script…
  7. Q8Consider the following JavaScript code. What will be the output of the above code snippet on the console of the browser?
  8. Q9Consider the following HTML snippet that uses Vue 2 using CDN in the script.js file Filename: index.html Filename: scri…
  9. Q10Suppose you are organizing a felicitation program for the students with exemplary performance in the BS program. You ha…
  10. Q11Figure question
  11. Q12Which of the following statement(s) is/are incorrect regarding Vuex?
  12. Q13Consider the following HTML, with Vue 2 CDN attached to it. Filename: index.html Filename: script.js What will be logge…
  13. Q14Analyze the given HTML with embedded script. What will be the final state of HTML elements, after all the setTimeout() …
  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: …