← All Guides
🟢10 QUESTIONS • INTERMEDIATE TO ADVANCED

Top 50 NodeJS Interview Questions (2026)

Event loop, streams, Express, REST APIs, authentication and performance — all covered.

1

What is NodeJS?

NodeJS is a JavaScript runtime built on Chrome's V8 engine. It allows JavaScript to run on the server side. It uses an event-driven, non-blocking I/O model, making it lightweight and efficient for real-time applications.

2

What is the event loop in NodeJS?

The event loop is what allows NodeJS to perform non-blocking I/O operations. It processes callbacks from the callback queue when the call stack is empty. Phases: timers, I/O callbacks, idle, poll, check, close callbacks.

3

What is the difference between process.nextTick() and setImmediate()?

process.nextTick() executes callback before the next event loop iteration, after the current operation completes. setImmediate() executes callback in the check phase of the next event loop iteration.

4

What are streams in NodeJS?

Streams are objects that allow reading or writing data continuously. Types: Readable, Writable, Duplex (both), Transform (duplex that modifies data). They are memory efficient for handling large files.

5

What is middleware in Express?

Middleware is a function that has access to request, response, and next function. It executes in order, can modify req/res objects, end the request-response cycle, or call next() to pass to the next middleware.

6

What is the difference between require() and import?

require() is CommonJS module syntax, synchronous, and can be used anywhere. import is ES6 module syntax, asynchronous, and must be at the top level. NodeJS now supports both.

7

What is npm?

npm (Node Package Manager) is the default package manager for NodeJS. It manages project dependencies, scripts, and publishes packages to the npm registry.

8

What is the purpose of package.json?

package.json holds metadata about the project including name, version, dependencies, devDependencies, and scripts. It enables npm to install correct dependency versions.

9

What is clustering in NodeJS?

Clustering allows NodeJS to create child processes (workers) that share the same port. Since NodeJS is single-threaded, clustering utilizes multiple CPU cores to handle more requests.

10

How does error handling work in NodeJS?

In async code: use try/catch with async/await or .catch() with Promises. For EventEmitter, listen to error event. Use process.on("uncaughtException") as last resort. Always handle errors to prevent crashes.

🔒

Want All 50 NodeJS Questions?

Sign up free to access complete notes — DSA, System Design, HR and more.

🚀 Access Full Notes Free →

Ready for your interview?

Build Free Resume →