Black Friday Flash Sale:

50% OFF ALL PRODUCTS
Ends in--d--h--m--s
COUPON:BLACKFRIDAY50

Node.js Practice Test 2026: 10 Free Questions with Answers

Node.js Developer Practice Tests: 2 Practice Tests and 80 Questions
In this article

Node.js  ·  Practice tests  ·  Updated November 2026

A Node.js practice test checks how well you know server-side JavaScript on Node.js: the event loop, events and streams, buffers and the file system, HTTP and fetch, worker threads, Express, crypto, testing and databases. The best ones show short code and ask what it prints or which API is safe, because back-end interviews test the same skills. Node.js 26 is the latest LTS line, Node.js 24 and 22 are still supported, and the OpenJS Node.js certification exams were retired on 30 September 2025. Below you will find what a good Node.js practice test covers, a 2–3 week plan and 10 free Node.js practice questions with answers.

At a glance

TopicNode.js back-end development
Latest LTS lineNode.js 26 (Lithium)
Also supportedNode.js 24 and 22 (Maintenance LTS)
Node.js certificationJSNAD and JSNSD retired 30 September 2025
ExpressVersion 5 is the current release
Exametics set2 practice tests, 80 questions
  • Expect code-reading questions: what runs first, what a snippet prints and which API is safe.
  • Practise on an LTS release. The Node.js project says production applications should only use Active LTS or Maintenance LTS releases.

Source: Node.js releases, Node.js Release schedule and Linux Foundation JSNAD page. Checked on 9 November 2026.

What a good Node.js practice test covers

A good Node.js practice test covers how Node.js actually runs your code, not trivia: when callbacks fire, how data moves through streams, and how a small service handles errors, passwords and user input. These are the nine topic areas the Exametics Node.js questions are tagged with:

  • 1. Event loop and asynchronous patterns: The order of callbacks, promises, timers and process.nextTick().
  • 2. Events and streams: EventEmitter errors, pipe() and pipeline().
  • 3. Buffers and the file system: Encodings, bytes versus characters, sync versus async calls.
  • 4. HTTP and web APIs: Servers, fetch() and status handling.
  • 5. Child processes, worker threads and cluster: Choosing the right tool for CPU work.
  • 6. Express: Routing, middleware and Express 5 error handling.
  • 7. Security and crypto: Password hashing, salts and constant-time checks.
  • 8. Testing and debugging: node:test, node –test and assertions.
  • 9. Data and databases: Prepared statements and safe queries.

A good test also says which Node.js version it targets. The Node.js releases page lists 22, 24 and 26 as LTS lines, and APIs change between them. For example, the built-in SQLite module exports DatabaseSync on Node.js 24, while the current documentation names the class Database and keeps DatabaseSync as a deprecated alias. A question that ignores the version can have two right answers.

The event loop and asynchronous patterns

Event loop questions check the order in which synchronous code, process.nextTick() callbacks, promise callbacks and timers run.

The Node.js process documentation says the next tick queue is fully drained after the current operation finishes and before the event loop continues. In CommonJS modules, process.nextTick() callbacks always run before promise microtasks. In ES modules the order flips. The current documentation also marks process.nextTick() as legacy and recommends queueMicrotask() instead.

The Node.js event loop guide says the order of setTimeout(fn, 0) and setImmediate() in the main module is non-deterministic. Inside an I/O callback, the immediate callback always runs first.

Events, streams, buffers and the file system

These questions check that you can move data without leaks or crashes:

  • The 'error' event: the Node.js events documentation says that if an EventEmitter emits 'error' with no listener, the error is thrown and the process exits.
  • pipe() versus pipeline(): the Node.js stream documentation warns that with pipe() the destination is not closed when the source fails. stream.pipeline() closes all the streams when an error is raised and has a promise version.
  • Bytes versus characters: the Node.js Buffer documentation says UTF-8 is the default encoding, and it is multi-byte. A string’s length and its size in bytes are not always the same.
  • Sync file calls: the Node.js file system documentation says the synchronous APIs block the event loop until the operation is complete. fs.readFile() returns a raw buffer if you give no encoding.

HTTP, web APIs, worker threads and cluster

The Node.js globals documentation shows that fetch() has been available without a flag since version 18 and stable since version 21. Its example checks res.ok before reading the body, a trap you will meet in question 5.

The Node.js worker threads documentation says workers are useful for CPU-intensive JavaScript but do not help much with I/O-intensive work. It also says that, unlike child_process or cluster, worker threads can share memory.

Express, security and crypto

Express 5 is the current release on the Express npm page, so check that practice questions do not assume Express 4. The Express error-handling guide says error-handling middleware has four arguments, (err, req, res, next). It also says handlers that return a rejected promise now call next(value) for you.

The Node.js crypto documentation describes scrypt as a password-based key derivation function designed to be expensive, recommends a random salt of at least 16 bytes, and offers crypto.timingSafeEqual() for comparing hashes and tokens in constant time.

Testing, debugging and working with data

The Node.js test runner documentation marks node:test as stable and says node --test runs files that match patterns such as *.test.js. Questions often contrast assert.strictEqual() and assert.deepStrictEqual().

The Node.js SQLite documentation says prepared statement parameters protect against SQL injection, so use them instead of hand-built SQL strings. The same rule holds for other database drivers; our guide to MongoDB Associate Developer practice tests on CRUD and indexes covers that side.

Exametics practice tests

Node.js Developer Practice Tests

30-day refund. Instant access after payment.

Who these Node.js practice tests are for

These Node.js practice tests are for back-end and full-stack JavaScript developers, and for job seekers who want an honest check of their Node.js before an interview or a new project.

They suit you if you already write JavaScript and have built a small server or script with Node.js. Still learning core JavaScript? Start with our guide to JavaScript interview questions on closures, async code and the DOM.

Full-stack developers can add our React.js practice tests comparison for the front end.

Junior, mid-level and senior expectations

LevelWhat you should handle in a Node.js test
JuniorModules, async/await, reading files, a basic Express route, simple tests with node:test
Mid-levelEvent loop order, streams and pipeline(), error middleware, fetch() status handling, prepared statements
SeniorWorker threads versus cluster, back-pressure, password hashing and constant-time checks, LTS upgrade planning

Is there a Node.js certification in 2026?

The OpenJS Node.js certification exams are retired. The Linux Foundation pages say the OpenJS Node.js Application Developer (JSNAD) exam and the OpenJS Node.js Services Developer (JSNSD) exam were both retired as of 30 September 2025, and they name no replacement.

That is why the Exametics Node.js set is a knowledge and interview-preparation bank, not a copy of any vendor exam. For a certificate on your CV, our JSE-40-01 JavaScript certification guide explains one entry-level option.

OptionStatus in November 2026
OpenJS JSNAD (Node.js Application Developer)Retired 30 September 2025
OpenJS JSNSD (Node.js Services Developer)Retired 30 September 2025
Replacement Node.js examNot published

Next on your JavaScript path

See all programming language practice tests →

How to prepare with a Node.js practice test in 2–3 weeks

If you already use JavaScript, plan two to three weeks: one on runtime internals, one on building and securing a service, and a few days of timed practice.

  1. Days 1–3: set up and take a baseline Install a current LTS release, such as Node.js 24 or 26. Take one practice test untimed and note your two weakest topic areas.
  2. Days 4–7: event loop, events and streams Write tiny scripts that log the order of nextTick, promises, timers and setImmediate. Rebuild a file copy with stream.pipeline() and make it fail on purpose.
  3. Week 2, first half: HTTP, Express and data Build a small Express 5 API with one async route, an error-handling middleware and a database query using placeholders. Call it with fetch() and handle a 404.
  4. Week 2, second half: security, workers and tests Hash a password with scrypt and a random salt, move a CPU-heavy loop into a worker thread, and cover both with node:test and node --test.
  5. Week 3: timed practice and review Take the timed Exam Mode test in the Node.js Developer practice tests. Read every explanation, even for right answers.

Tip

Run the code. Most Node.js questions have a provable answer, so run each snippet on the version the question targets. If your result differs, check the official docs.

Planning more than one exam?

If Node.js is one step on a wider path, the All-Access Pass covers every practice test on Exametics, including new exams as they are added, with lifetime access. It costs less than buying about six single practice tests.

Free Node.js practice questions (10 with answers)

Try these 10 free Node.js practice questions, original sample questions with one or two per topic area. The full Exametics Node.js practice test set has 80 more questions like these.

Practice question 1 · Event loop and asynchronous patterns

This code is saved as a CommonJS file (app.cjs) and run with Node.js. What does it print?

  • A. A B C D E
  • B. A E C D B
  • C. A E D C B
  • D. A E B D C
console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve().then(() => console.log('C'));
process.nextTick(() => console.log('D'));
console.log('E');

Answer: C. Synchronous code runs first, so A and E print. Then the next tick queue is drained (D), then the promise microtask queue (C), and only then does the event loop reach the timers phase (B). A treats everything as synchronous. B puts the promise before nextTick, which is the order in an ES module, not in CommonJS. D runs the timer before the microtasks, but a 0 ms timer still waits for the event loop.

Practice question 2 · Events and streams

What happens when this script runs?

  • A. It prints “before” and “after”; the error is ignored because no one listens.
  • B. It prints “before”, then “after”, then the error message.
  • C. It prints “before” and “after”, and Node.js logs a warning about a missing listener.
  • D. It prints “before”, then throws the error and the process exits; “after” never prints.
const { EventEmitter } = require('node:events');
const bus = new EventEmitter();
console.log('before');
bus.emit('error', new Error('boom'));
console.log('after');

Answer: D. The 'error' event is special. With no 'error' listener, emit('error') throws the error, prints a stack trace and the process exits with code 1. A would be true for any other event name with no listener. B is wrong because the throw happens synchronously inside emit(), before the next line. C confuses this with the warning Node.js prints when too many listeners are added.

Practice question 3 · Events and streams

A service copies uploaded files with readStream.pipe(gzip).pipe(writeStream). When the read stream fails half-way, file handles stay open. Which change fixes this most directly?

  • A. Add readStream.on('end', ...) and close the write stream there.
  • B. Use await pipeline(readStream, gzip, writeStream) from node:stream/promises.
  • C. Read the whole file with fs.readFileSync() and write it in one call.
  • D. Call gzip.setMaxListeners(0) so error listeners are not dropped.

Answer: B. With pipe(), an error in the source does not close the destination, so you must clean up by hand. pipeline() destroys every stream in the chain when one fails and gives you one promise (or callback) to handle the error. A fails because 'end' is emitted only when all the data has been consumed, so it never fires when the read fails half-way. C removes streaming altogether: it blocks the event loop and loads the whole file into memory. D only changes the listener-count warning and does nothing about cleanup.

Practice question 4 · Buffers and the file system

What does this code print?

  • A. 4 4
  • B. 5 5
  • C. 4 5
  • D. 5 4
const s = 'café';
console.log(s.length, Buffer.from(s).length);

Answer: C. The string has four characters, so s.length is 4. Buffer.from(s) uses UTF-8 by default, and “é” takes two bytes in UTF-8, so the buffer is 5 bytes long. A assumes one byte per character, which is only true for plain ASCII. B and D mix up which value counts characters and which counts bytes. This matters when you set a Content-Length header: use Buffer.byteLength(), not string.length.

Practice question 5 · HTTP and web APIs

On Node.js 24, a server answers GET /missing with status 404. This code runs as an ES module (app.mjs). What does it print?

  • A. ok: false 404
  • B. failed
  • C. ok: true 404
  • D. Nothing; fetch() needs the --experimental-fetch flag
try {
  const res = await fetch('http://localhost:3000/missing');
  console.log('ok:', res.ok, res.status);
} catch (err) {
  console.log('failed');
}

Answer: A. fetch() resolves as soon as it gets an HTTP response, whatever the status code. A 404 is still a response, so the promise resolves with res.ok set to false and res.status set to 404. B is what happens on a network failure, such as a refused connection, not on an error status. C is wrong because ok is true only for statuses 200 to 299. D is outdated: fetch() has not needed a flag since Node.js 18 and has been stable since Node.js 21.

Practice question 6 · Child processes, worker threads and cluster

An API must run a CPU-heavy JavaScript calculation without freezing other requests, and it needs to share a large SharedArrayBuffer with the code doing the work. Which module fits best?

  • A. child_process, using exec() to run a second Node.js script
  • B. cluster, forking one worker process per CPU core
  • C. process.nextTick(), to split the work into small pieces
  • D. worker_threads, running the calculation in a Worker

Answer: D. Worker threads run JavaScript in parallel inside the same process and are meant for CPU-intensive work. Unlike child_process or cluster, they can share memory through SharedArrayBuffer. A and B start separate processes, which cannot share that buffer and must copy data through messages. C does not add parallelism at all: next tick callbacks still run on the main thread, and recursive nextTick calls can starve I/O.

Practice question 7 · Express

In an Express 5 app, which function will Express treat as error-handling middleware?

  • A. app.use((req, res, next) => { res.status(500).send('Error') })
  • B. app.use((err, req, res, next) => { res.status(500).send('Error') })
  • C. app.use((err, req, res) => { res.status(500).send('Error') })
  • D. app.on('error', (err) => { console.error(err) })

Answer: B. Express recognises error-handling middleware by its four arguments: (err, req, res, next). Register it after your routes. A is ordinary middleware; it runs for normal requests, not for errors. C has only three parameters, so Express treats it as normal middleware and passes the request object as err. D listens for an event on the app object and does not take part in request error handling.

Practice question 8 · Security and crypto

You are storing user passwords with only the built-in node:crypto module. Which approach is the safest?

  • A. crypto.scrypt() with a random salt of at least 16 bytes per user, then compare hashes with crypto.timingSafeEqual()
  • B. crypto.createHash('sha256') on the password, then compare the hex strings with ===
  • C. crypto.createCipheriv() with AES, so the password can be decrypted when needed
  • D. crypto.randomUUID() as a salt shared by every user, then SHA-512

Answer: A. scrypt is a password-based key derivation function that is deliberately slow and memory-hungry, which makes brute-force attacks costly. The Node.js docs recommend a random salt of at least 16 bytes, and timingSafeEqual() compares the results in constant time. B uses a fast hash with no salt, so leaked hashes can be cracked quickly, and === is not a constant-time comparison. C stores passwords in a reversible form, so anyone with the key gets every password. D uses one salt for all users and a fast hash, so identical passwords produce identical hashes.

Practice question 9 · Testing and debugging

This file is run with node --test. What is the result?

  • A. The test passes, because both objects have the same keys and values.
  • B. The test is skipped, because test() must be wrapped in describe().
  • C. The file is not run, because node --test only works with ES modules.
  • D. The test fails, because the two literals are different objects; assert.deepStrictEqual() would pass.
const test = require('node:test');
const assert = require('node:assert');

test('user', () => {
  assert.strictEqual({ id: 1 }, { id: 1 });
});

Answer: D. assert.strictEqual() checks that two values are the same, and for objects that means the same reference. Two separate object literals are never the same object, so it throws an AssertionError and the test fails. assert.deepStrictEqual() compares structure and would pass. A describes deep equality, not strict equality. B is wrong because top-level test() calls work on their own, and describe() is just an alias for suite(). C is wrong because the test runner runs CommonJS files as well as ES modules.

Practice question 10 · Data and databases

A login route receives email from the request body and looks up the user in SQLite. Which line is safe against SQL injection?

  • A. db.prepare(`SELECT * FROM users WHERE email = '${email}'`).get()
  • B. db.prepare("SELECT * FROM users WHERE email = '" + email.trim() + "'").get()
  • C. db.prepare('SELECT * FROM users WHERE email = ?').get(email)
  • D. db.prepare(`SELECT * FROM users WHERE email = '${encodeURIComponent(email)}'`).get()

Answer: C. The ? placeholder makes the database bind email as data, so it can never change the SQL itself. With the input x' OR '1'='1, C returns no row, while A returns a user. A and B build the query string from user input, and calling prepare() on a finished string does not make it safe; trim() only removes leading and trailing whitespace. D uses URL encoding, which is not SQL escaping: encodeURIComponent() leaves ' unencoded, so the input x'OR'1 still returns a user.

How did you score?

8–10 correct on these free practice questions: take a full timed test to check your speed. Under 8: revise the topic area you missed most, run the snippets yourself, then try again. The Node.js Developer practice tests have 80 more questions like these.

Common mistakes in Node.js practice tests

Most wrong answers in Node.js practice tests come from habits: guessing the event loop order, forgetting async errors and trusting tutorials written for retired versions.

  • Treating ES modules and CommonJS the same. The order of nextTick and promise callbacks depends on the module type, so read whether a snippet is .cjs or .mjs.
  • Ignoring the 'error' path. An emitter with no error listener crashes the process. Use pipeline() and add error listeners.
  • Assuming fetch() throws on 404 or 500. Check res.ok or res.status every time.
  • Blocking the event loop. Use the async APIs for I/O and worker threads for CPU work.
  • Learning on an end-of-life release. The Node.js releases page lists Node.js 20 and 25 as end-of-life.

Node.js dumps and copied question banks

Since the OpenJS Node.js exams are retired, a file sold as “JSNAD dumps” cannot help you pass a live exam, and any questions they contain predate current Node.js releases. Their answers about fetch flags or Express 4 behaviour can now be wrong. Practice tests that explain every answer, plus code you run yourself, build the reasoning interviewers actually test. For other languages, see our TypeScript practice tests on types, generics and everyday code.

Node.js practice test FAQs

The Exametics Node.js Developer Practice Tests have 2 practice tests with 40 questions each, 80 questions in total, including a timed Exam Mode test. They are a knowledge and interview-preparation bank, not a copy of an official exam.

Yes. This post has 10 free Node.js practice questions with answers, covering the event loop, events and streams, buffers, fetch, worker threads, Express, crypto, testing and SQL injection. The full Exametics Node.js practice tests have 80 more questions like these.

A good Node.js practice test covers the event loop, events and streams, buffers and the file system, HTTP and web APIs, worker threads and cluster, Express, security and crypto, testing, and databases. It should also name the Node.js version it targets, because APIs change between LTS lines.

Not from OpenJS. The Linux Foundation pages say the OpenJS Node.js Application Developer (JSNAD) and Node.js Services Developer (JSNSD) exams were retired as of 30 September 2025, and they name no replacement.

Use an LTS release. The Node.js releases page lists Node.js 26 as the latest LTS line, with 24 and 22 still LTS, and says production applications should only use Active LTS or Maintenance LTS releases. The code snippets in the Exametics practice tests were run on Node.js 24.

The syntax is plain JavaScript, but tests check details such as event loop order, stream errors and safe crypto. If you already write JavaScript, two to three weeks of focused practice with a Node.js practice test and the official docs is a realistic plan.

Learn core JavaScript first, especially promises and async/await, because every Node.js question builds on it. Then practise Node.js itself, and add TypeScript once you are comfortable writing a small server.

Official sources: Node.js releases and Linux Foundation JSNAD retirement notice. Checked on 9 November 2026.

Take the full Node.js practice test: 80 questions

Scored well on the 10 free questions? The full set has two practice tests, 80 questions and a timed Exam Mode test, rebuilt in November 2026 for current Node.js LTS releases. If you also plan JavaScript, TypeScript or database practice, the All-Access Pass covers every practice test on Exametics.

✓ Every answer explained  ·  ✓ Timed exam mode  ·  ✓ 30-day refund

Ready to test yourself?

Take timed, exam-style practice tests and see exactly which domains need more work before exam day.

Share this article

Leave a Comment

All-Access Pass
Practise for 800+ certification exams

Timed, exam-style tests with an explanation for every answer. Lifetime access.

₹18,808
Related practice tests
Practice Test

Price range: ₹944 through ₹1,416

Select options This product has multiple variants. The options may be chosen on the product page
Practice Test
11 practice tests
1000+ questions

Price range: ₹944 through ₹1,416

Select options This product has multiple variants. The options may be chosen on the product page
In this article

Keep reading

Get new exam guides in your inbox

One short email when we publish new guides and practice tests. No spam.

Shopping Cart
Scroll to Top