Boarding pass · Node.js Intermediate
Node.js · Intermediate interview
An AI mock interview for Node.js developers with a couple of years' experience. Go deeper into the event loop, streams and backpressure, robust API and error handling, and the first layer of performance and scaling.
- Voice interview
- Live feedback
- Browser-only
- No installation required
Your report · sample
AI Readiness Score
Finish the mock and get this report — scored on content and English, with concrete tips and a model answer for every question, plus a study plan.
Your flight path
Five steps to interview-ready.
From a quick warm-up to a personalised study plan — here's the whole loop, and what you get at each gate.
Step 01
Preparation
Skim the topics and warm up — you're briefed before takeoff.
Step 02
AI Interview
A realistic AI interviewer asks tailored questions — answer by voice or text.
Step 03
Instant Score
Finish and get a 0–100 readiness score across content and English.
Step 04
AI Feedback
Concrete tips and a rewritten model answer for every response.
Step 05
Study Plan
A personalised plan targets your weakest areas — so the next run scores higher.
Preview the AI demo
See one answer scored, end to end.
The whole loop on sample data — question, your answer, instant feedback and a study plan. Hover to pause.
Interviewer · Question 1
“Tell me about yourself.”
Who it's for
- Developers who've shipped Node services
- Engineers comfortable with Express and async
- Anyone targeting mid-level backend roles
- Devs filling gaps before interviews
What you'll practice
- Reasoning about event-loop phases and ordering
- Working with streams and backpressure
- Structuring robust APIs and error handling
- Avoiding event-loop blocking and leaks
Topics covered
What this level expects.
Event loop & async
- Event-loop phases
- nextTick vs setImmediate
- Microtasks vs macrotasks
Streams & buffers
- Stream types
- Backpressure
- Piping
APIs & errors
- Error-handling middleware
- Validation
- CORS
Performance
- Blocking the loop
- Clustering & worker_threads
- Memory leaks
Practice questions
12 questions, with model answers.
Read them, then run the live mock to answer out loud and get scored. Tap any question to reveal a model answer.
01Walk me through the main phases of the Node event loop.Event loop & async
Each loop iteration moves through phases: timers (due setTimeout/setInterval callbacks), pending callbacks, poll (retrieve I/O events and run their callbacks), check (setImmediate callbacks), and close callbacks. Between every phase — and after each macrotask — Node drains the microtask queues: process.nextTick first, then resolved promises. Understanding this order explains why callbacks fire when they do.
02What's the difference between process.nextTick, setImmediate, and setTimeout(fn, 0)?Event loop & async
process.nextTick runs before the event loop continues, draining after the current operation and before promises — overusing it can starve I/O. setImmediate runs in the check phase, after the poll phase completes. setTimeout(fn, 0) runs in the timers phase on the next iteration, with a minimum delay. So roughly: nextTick → promises → (loop phases) → setImmediate, while setTimeout depends on timer scheduling.
setTimeout(() => console.log("timeout"), 0);
setImmediate(() => console.log("immediate"));
process.nextTick(() => console.log("nextTick")); // prints first03What's the difference between a microtask and a macrotask in Node?Event loop & async
Macrotasks are scheduled by the event-loop phases — timers, I/O callbacks, setImmediate. Microtasks are process.nextTick callbacks and promise reactions, and they're drained completely after each macrotask (and between phases) before the loop moves on. That's why a chain of resolved promises runs before the next setTimeout, even a zero-delay one.
04What are streams in Node, and what are the main types?Streams & buffers
Streams process data in chunks instead of loading it all into memory, which is essential for large files or network data. The four types are Readable (source, e.g. fs.createReadStream), Writable (sink, e.g. an HTTP response), Duplex (both, e.g. a TCP socket), and Transform (a duplex that modifies data, e.g. gzip). They let you build memory-efficient pipelines.
05What is backpressure and how do streams handle it?Streams & buffers
Backpressure is when a writable destination can't keep up with how fast a readable source produces data. If you ignore it, memory balloons. write() returns false when the internal buffer is full, signalling you to pause until a 'drain' event; pipe() and pipeline() handle this automatically by pausing the source until the destination catches up. That's why piping is preferred over manual read/write loops.
const { pipeline } = require("stream");
pipeline(src, gzip, dest, (err) => { if (err) handle(err); });06Why use pipeline() instead of .pipe()?Streams & buffers
pipe() chains streams but doesn't propagate errors or clean up the other streams if one fails, which can leak file descriptors. pipeline() (or its promise form) wires the streams together AND forwards errors and destroys all streams on failure, giving you a single completion callback. For production pipelines, pipeline is the safer default.
07How do you handle errors thrown in async Express route handlers?APIs & errors
A thrown error or rejected promise inside an async handler isn't automatically caught by Express (in Express 4), so it can hang the request. You either wrap handlers in a try/catch that calls next(err), use an async-wrapper helper, and then define a single error-handling middleware with four arguments (err, req, res, next) at the end to format the response consistently. Express 5 forwards rejected promises to that error middleware automatically.
const wrap = fn => (req, res, next) => Promise.resolve(fn(req, res, next)).catch(next);
app.use((err, req, res, next) => res.status(err.status || 500).json({ error: err.message }));08How do you validate and sanitize incoming request data?APIs & errors
Never trust client input. Use a schema validator (Zod, Joi, express-validator) to check body, query, and params against an explicit schema in a middleware, rejecting bad requests with a 400 before they reach business logic. This prevents type bugs, injection, and malformed data, and gives you a single place to document the contract.
09What is CORS and when do you need to configure it?APIs & errors
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that blocks a web page from calling an API on a different origin unless the API opts in with the right response headers. You configure it (e.g. the cors middleware) when your frontend is served from a different origin than your API, specifying allowed origins, methods, and whether credentials are allowed. It's enforced by the browser, not the server.
10What happens if you run a CPU-heavy task on the main thread, and how do you fix it?Performance
It blocks the single event-loop thread, so every other request stalls until it finishes — throughput collapses and timeouts appear. Fixes: offload the work to a worker_thread or a separate process/service, break it into chunks that yield to the loop, or move it to a queue/background worker. The rule is to keep the main thread for orchestration and I/O, not number-crunching.
11What's the difference between cluster and worker_threads?Performance
cluster forks multiple Node processes that share a listening port, each with its own memory and event loop — good for scaling a stateless HTTP server across CPU cores. worker_threads run multiple threads inside one process sharing memory via SharedArrayBuffer — good for CPU-bound work you want to parallelize without full process overhead. Cluster for scaling requests; worker_threads for parallel computation.
12How would you find a memory leak in a Node service?Performance
Watch RSS/heap growth over time; if it climbs and never recovers under steady load, you likely have a leak. Take heap snapshots with the Chrome DevTools inspector (--inspect) at intervals and compare retained objects, or use clinic/heapdump. Common causes are unbounded caches, listeners never removed, closures holding large objects, and globals that keep growing.
Preparation tips
Walk in ready.
- Be able to order nextTick, Promise, setTimeout, setImmediate output
- Implement a stream pipeline with proper error handling
- Centralize error handling in one Express middleware
- Know how to spot an event-loop block
Ready for the real thing?
Run a 6-question Node.js mock interview, answer out loud, and get a readiness score with tips and model answers.
More intermediate interviews