Async JavaScript: Promises, Async/Await, Event Loop

20 QuestionsIntermediatePublished:

Async JavaScript: Promises, Async/Await, Event Loop

Up to 20 questions, shuffled on every run

Quiz Configuration
Enterto start

Welcome to the Async JavaScript quiz! Test your knowledge of Promises, async/await, the event loop, and advanced concurrency patterns. Each question has a hint and detailed explanations for all options. Good luck!

Answer key and explanations20 questions

The quiz above draws 20 questions at random from these 30, so a second attempt will not be the same run. Everything in the pool is listed here.

  1. What is the JavaScript event loop?

    AnswerThe mechanism that monitors the call stack and moves tasks from the callback queue to the stack

  2. What is a callback function?

    AnswerA function passed into another function as an argument to be executed at a later time

  3. What is callback hell?

    AnswerA situation where deeply nested callbacks make code difficult to read and manage errors

  4. What is a Promise?

    AnswerAn object representing the eventual completion or failure of an asynchronous operation

  5. What does Promise.resolve() do?

    AnswerReturns a Promise object that is resolved with a specified value or result

  6. What does Promise.reject() do?

    AnswerReturns a Promise object that is rejected with a given reason or error message

  7. What is an async function?

    AnswerA function that always returns a Promise and allows the use of the await keyword

  8. What is the purpose of the await keyword?

    AnswerPauses the execution of an async function until a Promise settles and returns its result

  9. How does Promise.all() behave?

    AnswerFulfills when all input Promises fulfill, but rejects immediately if any Promise rejects

  10. What is the behavior of Promise.race()?

    AnswerReturns a Promise that settles as soon as any of the input Promises fulfill or reject

  11. What is the microtask queue?

    AnswerA high-priority queue for Promises and MutationObservers processed before the next macrotask

  12. How does setTimeout interact with the event loop?

    AnswerIt schedules a callback to be executed as a macrotask after the current stack and microtasks

  13. What is error handling with async/await?

    AnswerThe use of try/catch blocks to capture and handle errors from awaited Promises

  14. What is the use case for Promise.allSettled()?

    AnswerWhen you need to wait for all operations to complete regardless of their individual success or failure

  15. What is the behavior of Promise.any()?

    AnswerIt returns the first Promise that fulfills, and only rejects if every input Promise rejects

  16. What is the role of the Promise constructor?

    AnswerIt creates a new Promise where an executor function manually controls the resolve and reject calls

  17. What is Promise chaining?

    AnswerA pattern where each .then() returns a new Promise, allowing for sequential async operations

  18. What is the unhandledrejection event?

    AnswerA global event fired when a Promise is rejected and no rejection handler is attached to it

  19. What is the AbortController API?

    AnswerAn interface that allows you to abort one or more Web requests or asynchronous operations

  20. What is the primary function of the Fetch API?

    AnswerA modern, Promise-based interface for making network requests and handling responses

  21. What is an async iterator?

    AnswerAn object that implements the Symbol.asyncIterator method for use with for-await-of loops

  22. What is the difference between concurrent and sequential execution?

    AnswerConcurrent runs independent tasks in parallel; sequential waits for each task to finish before starting the next

  23. What is top-level await?

    AnswerThe ability to use the await keyword at the highest level of a module without an async function

  24. What is async context preservation?

    AnswerEnsuring that "this" and other closure variables remain accessible across asynchronous boundaries

  25. What is the retry pattern in asynchronous code?

    AnswerA strategy of wrapping async calls in a loop with error handling and exponential backoff

  26. What is a typical use case for Promise.allSettled()?

    AnswerHandling a batch of independent operations where partial success is acceptable and results must be tracked

  27. What is the purpose of debouncing an asynchronous operation?

    AnswerTo limit the rate at which a function executes by waiting for a period of inactivity before triggering

  28. How is Promise.then() return value transformed?

    AnswerIf the handler returns a value, the new Promise resolves to that value; if it returns a Promise, it waits for it

  29. What are asynchronous cleanup patterns?

    AnswerUsing try/finally blocks to ensure that resources like timers and connections are closed regardless of success

  30. What are generator functions?

    AnswerFunctions that can be exited and later re-entered, with their context preserved across multiple re-entries

Was this useful?

You might also enjoy

Check out some of our other posts on similar topics

Advanced CSS: Layouts, Modern Features & Performance

Advanced CSS: Layouts, Modern Features & Performance

Welcome to the Advanced CSS Quiz! Test your knowledge of modern CSS features, layout techniques, and performance optimization. This quiz covers CSS Grid, custom properties, animations, transforms, and

Advanced Frontend Patterns: State Management & Performance

Advanced Frontend Patterns: State Management & Performance

Master advanced frontend architecture: state management (Redux, Zustand), performance optimization, code splitting, lazy loading, and responsive design patterns.

Responsive Web Design: Mobile-First & Breakpoints

Responsive Web Design: Mobile-First & Breakpoints

Welcome to the Responsive Design Quiz! In today's mobile-first world, building websites that look great and function well on any device is essential. This quiz will test your knowledge of responsive d

JavaScript: Language Fundamentals & Modern Features

JavaScript: Language Fundamentals & Modern Features

Welcome to the JavaScript Basics Quiz! This quiz is designed to test your understanding of fundamental JavaScript concepts, syntax, and modern programming best practices. Each question is multiple-cho

Database Design & Patterns

Database Design & Patterns

Welcome to the Database Design & Patterns Quiz! Test your knowledge on database normalization, indexing, query optimization, ACID properties, sharding, replication, and more. Each question has a hint

Production Backend: Scaling, Monitoring & Reliability

Production Backend: Scaling, Monitoring & Reliability

Welcome to the "Production Backend: Scaling, Monitoring & Reliability" quiz! This quiz tests your knowledge of key concepts and best practices for running production backend systems at scale. You'll b

6 related posts