Quiz Space

Modern Application Development II · End Term · 31 Aug 2025 · May 2025 term · Set QIB3

Question 31: Prashant and Nikita are creating a quiz question paper c…

Question 31

+3 marksOne correct option

Prashant and Nikita are creating a quiz question paper collaboratively. They are each working on different sections — and complete their tasks in parallel. Meanwhile, Mayur is enjoying a single- player game that finishes when the game loop ends.
To compare productivity:
● If Prashant and Nikita (together) finish faster than Mayur, the winner is "Team".
● If Mayur finishes faster, he wins.
● If both take the same time, Mayur wins by default.
You are simulating this scenario in the browser.Prashant and Nikita are represented using parallel Promises. Mayur is represented using a single Promise. The frontend must calculate who finishes first using asynchronous logic, and display the result.

app.js

javascript
function simulateTasks() {
const prashant = new Promise(resolve => setTimeout(() =>
resolve("Prashant"), 3000));
const nikita = new Promise(resolve => setTimeout(() =>
resolve("Nikita"), 2000));
const mayur = new Promise(resolve => setTimeout(() =>
resolve("Mayur"), 4000));
const team = Promise.all([prashant, nikita]).then(() =>
"Team");
Promise.race([team, mayur]).then(winner => {
console.log("Winner is:", winner);
});
}

Based on the above data, answer the given subquestions.

If Prashant and Nikita finish together in 3 seconds (since Promise.all waits for both), and Mayur finishes in 4 seconds, who wins?

  1. A

    Mayur

  2. B

    Team

  3. C

    Nikita

  4. D

    Race condition prevents output

Show answer

Correct answer

  • B

    Team

Question 31 of 32 in the IIT Madras BS Modern Application Development II (MAD 2) End Term paper sat on 31 Aug 2025, in the May 2025 term (IIT M IMPROVEMENT AN EXAM QIB3 31 Aug 2025). It carries 3 marks.

This question was also asked in

More questions from this paper

  1. Q1In a message queue system, if the consumer is slower than the producer, what is likely to occur first?
  2. Q2What does "reactivity" mean in the context of frontend frameworks like Vue.js?
  3. Q3In Flask, what is the main benefit of using the @cache.cached() decorator?
  4. Q4What is the primary purpose of CORS (Cross-Origin Resource Sharing)?
  5. Q5Which of the following practices help protect against supply chain attacks?
  6. Q6Which of the following factors directly affect the speed and performance of a web page load?
  7. Q7Which of the following is/are the potential benefits of using a message broker?
  8. Q8Which statements about webhooks are correct?
  9. Q9A popular e-commerce platform needs to notify multiple third-party services (inventory management, email marketing, ana…
  10. Q10What is the main advantage of using caching in a Flask-based web application?
  11. Q11What will be the order of console output when the following JavaScript code is executed?
  12. Q12Consider the following JavaScript program: What will be the output of the above program?
  13. Q13Consider the following javascript program. What will be the output of the above program on the browser’s console?
  14. Q14Consider this HTML and Vue setup: index.html app.js What will be rendered on the browser?
  15. Q15Consider the following JavaScript code running in a browser: What will be the output in the browser console?
  16. Q16Which factors directly impact the Lighthouse "Performance" score?
  17. Q17Which statements are true about handling background tasks in Flask with Celery?
  18. Q18Which of the following are true about mutations and actions in Vuex?
  19. Q19Figure question
  20. Q20Scenario\ The component is loaded.\ User clicks "Mark Complete" for the task named Build Project.\ User clicks "Show Co…
  21. Q21Scenario\ The component is loaded.\ User clicks "Mark Complete" for the task named Build Project.\ User clicks "Show Co…
  22. Q22Scenario\ The component is loaded.\ User clicks "Mark Complete" for the task named Build Project.\ User clicks "Show Co…
  23. Q23Consider the following JavaScript code: Assuming this code runs in a browser environment, what will be the output?
  24. Q24Consider this Vue.js component code: What happens when a user types "Learn Vue" into the input field and presses Enter?…
  25. Q25Given this Vue Router setup: What component renders for URL /user/123/settings?
  26. Q26Given the Flask app: frontend code: What will happen when run from a Vue app hosted at <u>http://localhost:5173</u>?
  27. Q27What will this JavaScript code output?
  28. Q28Consider the following Vue component structure with nested components and complex slot configurations: Now consider thi…
  29. Q29Consider the following Vue Router configuration in a Vue 2 application: In a Vue component, you have these navigation m…
  30. Q30Using the same Vue Router configuration from the previous question, Select ALL correct statements about these navigatio…
  31. Q32Prashant and Nikita are creating a quiz question paper collaboratively. They are each working on different sections — a…