Asynchronous and Event-Driven Programming Questions

The programming model of a single asynchronous runtime: callbacks, promises and futures, async/await, event loops and task/microtask scheduling (including microtask starvation and where rendering fits), reactive streams and back-pressure, and how ordering, cancellation, timeouts, retries and error propagation behave across JavaScript, Node.js, mobile coroutine or async runtimes, and a comparison with Python asyncio and Java futures. Includes the async mechanics of a data fetch such as parallel versus sequential requests, partial failure, stale or out-of-order responses, abort, debounced live search, single-flight token refresh, and bounded concurrency; wrapping callback APIs as promises, streaming work through async consumers, moving heavy work off the main thread and back, and diagnosing unhandled rejections, race conditions and leaked subscriptions. Excludes message-queue and pub/sub system design, server throughput and thread-pool tuning, per-language threading and memory models, rebuilding standard APIs from scratch, and fetch caching or state architecture.

EasyTechnical
49 practiced

What is a promise and what states can it be in? Walk through what happens when you attach a handler before it settles and after it settles, why a handler never runs synchronously, and what a thenable is.

MediumTechnical
57 practiced

A dashboard has 50 independent widgets, and each one needs its own API call. How would you load them? Weigh the options on total latency, CPU and memory cost, network use, what the user sees while data arrives, and what happens when some calls fail, then tell me which you would pick and when.

EasyTechnical
52 practiced

A gallery page loads many images and thumbnails. When does it make sense to wait for every request, and when for only the first to answer? Give a concrete frontend case for each, and say what each approach does when one of the requests fails and what the user ends up seeing.

EasyTechnical
50 practiced

Predict the exact console output of this snippet and explain why it is in that order.

js
console.log('start');
setTimeout(() => console.log('timeout 0'), 0);
Promise.resolve().then(() => console.log('promise1')).then(() => console.log('promise2'));
console.log('end');
MediumTechnical
47 practiced

Write retryFetch(url, options, retries, backoffBaseMs) that retries only failures that are worth retrying, spaces attempts so many clients do not retry in lockstep, and stops a single hung attempt from blocking the rest. Explain which responses you would not retry and why.

Unlock Full Question Bank

Get access to all 23 Asynchronous and Event-Driven Programming interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.