LearnThatStack Ace your next interview
Backend Development

Node.js.

Start free Change topic Change
Practice · Questions

All questions

Showing of 59
Beginner 17
01

What is the V8 engine and how does Node.js use it?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

V8 is Google's open-source JavaScript engine, written in C++, and Node.js embeds it to run JavaScript outside the browser. V8 compiles your code to bytecode, a compact instruction format that its Ignition interpreter runs. While the code runs, V8 tracks the types it sees and the shapes of objects, which it calls hidden classes. Its just-in-time (JIT) compilers then turn functions that run often into optimized machine code.

V8 also manages the heap and garbage collection, but it does no I/O itself. Node.js handles I/O through libuv, a separate C library it bundles for the event loop and the thread pool.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

Explain the concept of non-blocking I/O in Node.js.

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

Non-blocking I/O means Node.js starts an I/O operation and keeps running other code instead of waiting for it to finish. Reading a file, querying a database and calling another server all work this way. When the result is ready, the event loop runs the callback you passed, or resumes the function that awaited the promise.

// Non-blocking example
const fs = require('fs');

console.log('Start reading file');
fs.readFile('large-file.txt', (err, data) => {
    console.log('File read complete');
});
console.log('This executes immediately');

// Output: Start reading file, This executes immediately, File read complete

This executes immediately prints before File read complete, because readFile returns at once and its callback runs later. The main thread never sits idle waiting on a disk or the network. That is how a single Node.js process handles thousands of concurrent connections.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What are callbacks and what is callback hell?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

A callback is a function you pass to another function, which calls it when an asynchronous operation finishes. Node.js core APIs follow the error-first convention. The first argument is an error or null, and the result comes after it.

Callback hell is the deep nesting you get when each step depends on the one before. The error check repeats at every level, which makes the code hard to read and maintain.

// Callback hell example
getData((err, data) => {
    if (err) return console.error(err);
    processData(data, (err, processed) => {
        if (err) return console.error(err);
        saveData(processed, (err, result) => {
            if (err) return console.error(err);
            console.log('Data saved successfully');
        });
    });
});

The fix is to flatten the chain. Promises and async/await turn it into a straight sequence with one place to handle errors. Splitting each step into a small named function also helps.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What is the difference between module.exports and exports?

Visual

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
Visual

require() returns module.exports, and exports is a reference to it: a shortcut variable that points at the same object when the module starts. Adding properties through either name works, because both point to one object. Assigning a new object to exports breaks that reference. The module still returns the original module.exports, so the new object never leaves the file.

// Method 1: Using exports (shorthand)
exports.add = (a, b) => a + b;
exports.subtract = (a, b) => a - b;

// Method 2: Using module.exports
module.exports = {
    add: (a, b) => a + b,
    subtract: (a, b) => a - b
};

// Method 3: Exporting a single function
module.exports = (a, b) => a + b;

// Wrong: This breaks the reference
exports = { add: (a, b) => a + b }; // Won't work

Use exports.name = value to export several named values. Use module.exports = value to export one function, class or object. The three methods above are alternatives. Mixing them in one file is a common bug, because a later module.exports assignment throws away everything added through exports.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What is npm and what are npm scripts?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

npm, short for Node Package Manager, is the package manager that ships with Node.js. It installs, updates and publishes JavaScript packages. npm scripts are named commands in the scripts field of package.json, which you run with npm run <script-name>.

{
  "scripts": {
    "start": "node server.js",
    "dev": "nodemon server.js",
    "test": "jest",
    "build": "webpack --mode production",
    "lint": "eslint .",
    "prestart": "npm run build"
  }
}

Scripts give a project one shared set of commands for development, testing and production builds. npm puts the project's installed tools on the PATH, so nodemon or jest run without a global install. A pre or post script runs before or after the script with the matching name, so prestart builds before start. Scripts run in the system shell, sh or cmd.exe, so a Unix-only command fails on Windows.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

Explain package.json and package-lock.json.

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

package.json describes the project and the version ranges it accepts, while package-lock.json records the exact versions npm installed. You edit package.json yourself. It holds the project metadata and scripts, plus the dependencies and devDependencies lists.

{
  "name": "my-app",
  "version": "1.0.0",
  "dependencies": {
    "express": "^4.18.0"
  },
  "devDependencies": {
    "nodemon": "^2.0.15"
  }
}

A range like ^4.18.0 accepts any later 4.x release, so two installs months apart can differ. npm install updates the lock file whenever it changes node_modules.

The lock file maps the exact dependency tree, sub-dependencies included, with an integrity hash for each package. A tampered download then fails the check. Commit the lock file so every environment installs the same tree, and use npm ci in builds to install exactly what it lists.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

How do you read and write files in Node.js?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Use the built-in fs module, which offers each read and write operation in three styles. The callback and promise versions hand the disk work to libuv's thread pool, a few background threads, so the server keeps answering other requests. The Sync versions block the event loop until the disk responds.

const fs = require('fs');

// Asynchronous (recommended)
fs.readFile('input.txt', 'utf8', (err, data) => {
    if (err) return console.error(err);
    console.log('File content:', data);
});

fs.writeFile('output.txt', 'Hello World', (err) => {
    if (err) return console.error(err);
    console.log('File written successfully');
});

// Synchronous (blocking)
try {
    const data = fs.readFileSync('input.txt', 'utf8');
    fs.writeFileSync('output.txt', data.toUpperCase());
} catch (err) {
    console.error('Error:', err);
}

// Promise-based
const fsPromises = require('fs').promises;
fsPromises.readFile('input.txt', 'utf8').then((text) => console.log(text)).catch(console.error);

In server code, use an asynchronous style. The promise version also works with await inside an async function. Use the Sync calls only in startup code and command-line scripts, where blocking does not matter.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

How do you create a basic HTTP server in Node.js?

Part of Pro
09

What is the difference between http and https modules?

Part of Pro
10

How do you make HTTP requests in Node.js?

Part of Pro
11

What is Express.js and why is it popular?

Part of Pro
12

How do you handle routing in Express.js?

Part of Pro
13

What is the difference between app.use() and app.get()?

Part of Pro
14

How do you handle form data and JSON in Express?

Part of Pro
15

How do you handle environment configuration in Node.js?

Part of Pro
16

What is Node.js, and when should you use it?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Node.js is an open-source, cross-platform runtime that runs JavaScript outside the browser, on Google's V8 engine. It adds what a server needs and a browser lacks, such as file system access and network servers. Its model is asynchronous and event-driven. One process serves many connections on a single thread, because I/O calls do not block while they wait.

That makes Node.js a strong fit for I/O-heavy work such as APIs, chat and streaming. Teams also gain one language across the front end and the back end, and the npm ecosystem. It is a poor fit for long CPU-heavy tasks such as video encoding, because a busy thread delays every other request. Worker threads ease that, but such work often belongs in a separate service.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

17

What is middleware in Express.js?

Part of Pro Visual
Intermediate 29
18

Explain the Node.js Event Loop and how it works.

Part of Pro Visual
19

Explain Promises in Node.js with examples.

Part of Pro
20

What is async/await and how does it improve asynchronous code?

Part of Pro
21

How do you handle errors in asynchronous operations?

Part of Pro
22

What is the difference between Promise.all() and Promise.allSettled()?

Part of Pro Visual
23

How does Node.js resolve modules?

Part of Pro
24

What are Streams in Node.js and when would you use them?

Part of Pro Visual
25

Explain the difference between fs.readFile() and fs.createReadStream().

Part of Pro
26

What is the Buffer class in Node.js?

Part of Pro
27

Explain request and response objects in Node.js HTTP.

Part of Pro
28

How do you handle errors in Express.js?

Part of Pro Visual
29

What are some common debugging techniques in Node.js?

Part of Pro
30

How do you implement caching in Node.js?

Part of Pro
31

What are common security vulnerabilities in Node.js applications?

Part of Pro
32

How do you implement authentication and authorization?

Part of Pro
33

How do you secure API endpoints?

Part of Pro
34

What is input validation and how do you implement it?

Part of Pro
35

How do you implement WebSockets in Node.js?

Part of Pro
36

What is the EventEmitter class and how do you use it?

Part of Pro Visual
37

How do you implement database connections and ORM in Node.js?

Part of Pro
38

How do you test a Node.js application?

Part of Pro
39

What is the middleware pattern and how do you write custom middleware?

Part of Pro
40

How do you implement pagination in Node.js APIs?

Part of Pro Visual
41

How do you deploy Node.js applications?

Part of Pro
42

How do you implement real-time features with Server-Sent Events (SSE)?

Part of Pro
43

What is the difference between CommonJS and ES6 modules in Node.js?

Part of Pro Visual
44

How do you handle rate limiting in Node.js applications?

Part of Pro Visual
45

Is Node.js single-threaded, and what does the libuv thread pool do?

Part of Pro Visual
46

What is the difference between child_process.spawn(), fork(), and exec()?

Part of Pro
Expert 13
47

How do you handle uncaught exceptions and unhandled rejections?

Part of Pro
48

How do you optimize performance in Node.js applications?

Part of Pro
49

What is clustering in Node.js and how does it work?

Part of Pro Visual
50

What is memory management in Node.js?

Part of Pro Visual
51

What are Worker Threads in Node.js?

Part of Pro Visual
52

What are design patterns commonly used in Node.js?

Part of Pro
53

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

Part of Pro Visual
54

How do you implement graceful shutdown in Node.js?

Part of Pro Visual
55

Explain memory leaks in Node.js and how to prevent them.

Part of Pro Visual
56

What is Node-API and how does it help with native addons?

Part of Pro
57

How do you implement logging and monitoring in production Node.js applications?

Part of Pro
58

What causes event loop lag, and how do you detect and prevent it?

Part of Pro Visual
59

What is AsyncLocalStorage, and what problem does it solve?

Part of Pro Visual

No matches

Try a different filter or search term.

Know someone prepping for Node.js? Send them this set.
Quick recap

Node.js in pictures.

A quick recap of Node.js in 32 short animated pictures, one idea at a time. About 9 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.

Pro The first chapter is free to play. The other 28 pictures come with Pro.

Get Pro · $10/mo
Pro · $10/mo

51 of 59 Node.js answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git