Quiz Space

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

Question 15: Consider the following JavaScript code. What will be log…

Question 15

+3 marksOne correct option

Consider the following JavaScript code.

javascript
function goUpDown(num) {
return new Promise((res, rej) => {
setTimeout(() => {
if (num < 20) {
return num > 10 ? res('Go Up') : res('Go Down')
} else {
return rej('Number Too Large')
}
}, 1000)
})
}
async function getData() {
const data3 = await goUpDown(8)
const data2 = await goUpDown(15)
const data1 = await goUpDown(12)
}
getData().then(
(data) => {
console.log(data)
},
(err) => {
console.log(err)
}
)

What will be logged on to console, if executed?

  1. A

    Go Up

  2. B

    Go Down

  3. C

    Number Too Large

  4. D

    None of these.

Show answer

Correct answer

  • D

    None of these.

Question 15 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 3 marks.

More questions from this paper

  1. Q1Which of the following statements is/are false.
  2. Q2Which of the following is/are correct regarding CDN.
  3. Q3Which of the following is correct regarding Celery?
  4. Q4Which of the following statement(s) is/are true regarding javascript language?
  5. Q5Which of the following method(s) does not guarantee that the displayed state and system state are kept in sync at all t…
  6. Q6You are trying to build a distributed system with N servers, each of which may need to communicate with any of the othe…
  7. Q7Which of the following statement(s) is/are false regarding webhooks?
  8. Q8Which of the following is correct regarding XSS attacks?
  9. Q9Which of the following is/are valid use(s) of “v-for” directive, assuming “obj” is an object having a number of key val…
  10. Q10Figure question
  11. Q11Which of the following statement(s) is/are false regarding long and short polling?
  12. Q12Which of the following statement(s) is/are false regarding caching?
  13. Q13Which of the following statements is true regarding CORS and CSRF?
  14. Q14Which of the following statement(s) is/are true regarding Celery?
  15. Q16Consider the following JavaScript code. Suppose there is an network error and fetch request to the ‘url’ fails. What wi…
  16. Q17Consider the JavaScript code. Suppose the ‘url’ returns a JSON response with 500 status code. What will be logged on to…
  17. Q18Consider the following JavaScript code. What will be logged on to console, if executed?
  18. Q19Consider the following Vue application with JavaScript “app.js” and markup “index.html” app.js index.html Suppose the a…
  19. Q20Consider the following Vue app with markup “index.html” and JavaScript “app.js” app.js index.html What will be rendered…
  20. Q21Consider the following Vue application with markup “index.html” and JavaScript “app.js” app.js index.html Suppose the a…
  21. Q22Consider the following flask application. app.py Suppose the application is running on “http://localhost:5000”. If user…
  22. Q23Figure question
  23. Q24Consider the below javascript program. What will be the output of the above program, if executed?
  24. Q25Consider the following JavaScript code. What will be logged on to console, if executed?
  25. Q26Consider the following Vue application with JavaScript “app.js” and markup “index.html” app.js index.html Suppose the a…
  26. Q27Consider the following Vue app with markup “index.html” and JavaScript “app.js” app.js index.html Suppose the applicati…
  27. Q28Consider the following flask application. app.py Suppose the application is running on “http://localhost:5000”. If user…
  28. Q29Consider the below javascript program. What will be the output of the above program, if executed?
  29. Q30Consider the below javascript program. What will be the output of the above program, if executed? Also, predict the min…
  30. Q31Consider the following Vue application with markup “index.html” and javascript file “app.js”. index.html: app.js: Suppo…
  31. Q32Fill in code1 \& code2, which can be used in Vuex Store to update the “below_average” state variable with the objects o…