Prepare for Node.js interview questions with MCQs covering server-side JavaScript fundamentals and production patterns. Topics include the Node.js event loop and its phases, non-blocking I/O, the module system (CommonJS vs ESM), streams and buffers, the cluster module and worker threads, child processes, the built-in http and https modules, error handling in async code, EventEmitter, path and fs module usage, environment configuration, and common Node.js design patterns. Node.js powers most JavaScript backends, and interviewers at product companies, consulting firms, and startups expect candidates to understand how it differs from browser JavaScript and how to design systems around its single-threaded event-driven architecture. Difficulty levels cover Trainee (core module usage, basic async/callback patterns), Junior Dev (streams, event emitter, Express middleware patterns), Mid Level (event loop phases, memory management, clustering, performance), and Senior Dev (production architecture, scalability patterns, profiling, microservice integration). Every explanation targets real interview gaps.
What this Node.js quiz covers
Trainee
- What Node.js is and npm install
- CommonJS exports and path.join
- Promises and process.exit
- Environment variables in .env
Junior Developer
- Express middleware, res.json and routers
- HTTP status codes (201, 401…)
- Password hashing with bcrypt
- Rate limiting and body parsing
Mid-Level
- Stream backpressure
- process.nextTick vs setImmediate
- EventEmitter and centralised error middleware
- Idempotency, caching and correlation IDs
Senior
- worker_threads and heap out-of-memory errors
- Prototype pollution and request size limits
- Dependency injection and event sourcing
- Node in containers: cgroups and V8 snapshots
Companies that ask Node.js questions: Amazon
Sample Node.js Interview Questions
Ten representative questions from our full bank of Node.js MCQs across all difficulty levels. Each one shows the correct answer and a short explanation. The interactive quiz above shuffles options and tracks your time per question.
- TraineeQ1
What is Node.js?
- A browser
- A JavaScript runtime outside the browser Correct
- A database
- A CSS framework
Why: Node.js runs JavaScript on servers and tooling using the V8 engine. - TraineeQ2
Which module reads files?
- fs Correct
- http
- path
- crypto
Why: The fs module provides filesystem APIs. - TraineeQ3
What file lists npm dependencies?
- package.json Correct
- index.html
- README.md
- node.lock
Why: package.json stores project metadata, scripts, and dependency declarations. - TraineeQ4
What does npm install do?
- Installs dependencies Correct
- Starts Docker
- Compiles SQL
- Creates a database
Why: npm install resolves and downloads packages into node_modules. - Junior DevQ5
What is middleware in Express?
- A function in the request-response chain Correct
- A database table
- A Docker image
- A CSS reset
Why: Middleware can inspect, modify, end, or pass along requests. - Junior DevQ6
What does require do in CommonJS?
- Imports a module Correct
- Starts a server
- Runs a test
- Reads only JSON
Why: require loads CommonJS modules and returns their exports. - Junior DevQ7
Why use streams?
- Process data in chunks to avoid high memory use Correct
- Store passwords
- Block the event loop
- Create threads only
Why: Streams avoid loading entire large payloads into memory. - Mid LevelQ8
What is backpressure in streams?
- A signal that consumers cannot keep up with producers Correct
- A CPU benchmark metric
- A cache miss indicator
- A port conflict error
Why: Backpressure prevents producers from overwhelming slower consumers. - Mid LevelQ9
Why avoid blocking crypto sync calls in hot paths?
- They block the event loop and delay other requests Correct
- They return CSS data
- They skip input validation
- They cannot hash large inputs
Why: Synchronous CPU-heavy work blocks all other requests in the event loop. - Senior DevQ10
Why use worker_threads?
- Run CPU-bound work off the main thread to avoid blocking Correct
- Open browser tabs from the server
- Replace HTTP with TCP
- Apply CSS server-side
Why: Worker threads keep CPU-heavy tasks from blocking the main event loop.
This is a static preview of 10 questions. Take the full interactive Node.js quiz with timed rounds, all 25 questions per level, and instant score tracking.
Frequently Asked Questions: Node.js Interviews
Common questions developers ask when preparing for Node.js technical interviews.
What Node.js topics are most commonly tested in backend interviews?
The event loop and non-blocking I/O model come up in almost every Node.js interview, interviewers want to verify you understand why Node.js is single-threaded yet handles concurrency. Other frequent topics include streams and buffers for handling large data, the module system (CommonJS vs ESM), error handling in async code, EventEmitter patterns, clustering for multi-core utilization, and common Express.js middleware patterns.
What is the Node.js event loop and why is it important?
The Node.js event loop is the mechanism that allows Node to perform non-blocking I/O despite being single-threaded. It processes callbacks in phases: timers (setTimeout/setInterval), pending callbacks, idle/prepare, poll (incoming I/O), check (setImmediate), and close callbacks. Understanding the phases explains why setImmediate runs before setTimeout in I/O callbacks, and why process.nextTick runs before both. This knowledge is critical for writing correctly ordered async code.
When should I use Node.js vs other backend technologies?
Node.js excels at I/O-bound workloads: real-time applications (chat, live notifications), API gateways, streaming pipelines, and microservices that spend most of their time waiting for databases or external APIs. It is less suited for CPU-intensive tasks (image processing, heavy computation) without worker threads. Its main advantages are the shared JavaScript ecosystem with frontend teams, npm, and the large community of Node-specific libraries.
How does Node.js handle concurrent requests if it is single-threaded?
Node.js delegates I/O operations (file reads, network requests, database queries) to the operating system via libuv, freeing the event loop thread to continue processing other requests. When the I/O completes, the callback is queued and runs on the next available event loop iteration. This means Node can serve thousands of concurrent connections without spawning a thread per connection, unlike traditional thread-per-request servers.
What is the difference between require() and import in Node.js?
require() is CommonJS (CJS), it loads modules synchronously, supports dynamic requires (require inside conditions), and is the traditional Node.js module system. import/export is ESM (ECMAScript Modules), it is statically analyzed, supports tree-shaking, and is the standard across browsers and modern Node.js. Node.js supports both: .cjs files use CommonJS, .mjs files use ESM, and .js files follow the type field in package.json. Most new Node.js projects default to ESM.