Async JavaScript: Promises, Async/Await, Event Loop
Async JavaScript: Promises, Async/Await, Event Loop
Up to 20 questions, shuffled on every run
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.
What is the JavaScript event loop?
AnswerThe mechanism that monitors the call stack and moves tasks from the callback queue to the stack
What is a callback function?
AnswerA function passed into another function as an argument to be executed at a later time
What is callback hell?
AnswerA situation where deeply nested callbacks make code difficult to read and manage errors
What is a Promise?
AnswerAn object representing the eventual completion or failure of an asynchronous operation
What does Promise.resolve() do?
AnswerReturns a Promise object that is resolved with a specified value or result
What does Promise.reject() do?
AnswerReturns a Promise object that is rejected with a given reason or error message
What is an async function?
AnswerA function that always returns a Promise and allows the use of the await keyword
What is the purpose of the await keyword?
AnswerPauses the execution of an async function until a Promise settles and returns its result
How does Promise.all() behave?
AnswerFulfills when all input Promises fulfill, but rejects immediately if any Promise rejects
What is the behavior of Promise.race()?
AnswerReturns a Promise that settles as soon as any of the input Promises fulfill or reject
What is the microtask queue?
AnswerA high-priority queue for Promises and MutationObservers processed before the next macrotask
How does setTimeout interact with the event loop?
AnswerIt schedules a callback to be executed as a macrotask after the current stack and microtasks
What is error handling with async/await?
AnswerThe use of try/catch blocks to capture and handle errors from awaited Promises
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
What is the behavior of Promise.any()?
AnswerIt returns the first Promise that fulfills, and only rejects if every input Promise rejects
What is the role of the Promise constructor?
AnswerIt creates a new Promise where an executor function manually controls the resolve and reject calls
What is Promise chaining?
AnswerA pattern where each .then() returns a new Promise, allowing for sequential async operations
What is the unhandledrejection event?
AnswerA global event fired when a Promise is rejected and no rejection handler is attached to it
What is the AbortController API?
AnswerAn interface that allows you to abort one or more Web requests or asynchronous operations
What is the primary function of the Fetch API?
AnswerA modern, Promise-based interface for making network requests and handling responses
What is an async iterator?
AnswerAn object that implements the Symbol.asyncIterator method for use with for-await-of loops
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
What is top-level await?
AnswerThe ability to use the await keyword at the highest level of a module without an async function
What is async context preservation?
AnswerEnsuring that "this" and other closure variables remain accessible across asynchronous boundaries
What is the retry pattern in asynchronous code?
AnswerA strategy of wrapping async calls in a loop with error handling and exponential backoff
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
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
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
What are asynchronous cleanup patterns?
AnswerUsing try/finally blocks to ensure that resources like timers and connections are closed regardless of success
What are generator functions?
AnswerFunctions that can be exited and later re-entered, with their context preserved across multiple re-entries








