Node.js Beginner Quiz
Modules, the runtime, file system basics and how Node differs from the browser — the groundwork every Node developer is expected to have.
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. What does this print?
console.log(typeof module.exports)
module.exports = 42
console.log(typeof module.exports)- object then object
- function then number
- undefined then number
- object then number
Show answer
Answer: object then number. `module.exports` starts life as an empty object, so `typeof` is "object". Reassigning it to 42 replaces the whole export value, so the second log is "number". This is why reassigning `module.exports` after other code has already required your module does not work as expected.
2. Which global is available in Node.js but NOT in a browser?
- console
- process
- setTimeout
- JSON
Show answer
Answer: process. `process` exposes the running Node process — argv, env, exit codes, stdin/stdout. `console`, `setTimeout` and `JSON` exist in both environments. Checking for `process` is a common (if imperfect) way to detect that code is running on the server.
3. Fill in the blank to read a file asynchronously with promises.
const fs = require('fs').promises
const text = ____ fs.readFile('data.txt', 'utf8')- await
- async
- yield
- return
Show answer
Answer: await. `fs.promises.readFile` returns a Promise, so `await` unwraps it to the file contents. Without the `utf8` encoding argument you would get a Buffer instead of a string.
Frequently asked questions
How many questions are in this Node.js quiz?+
30 questions, with a 30-minute time limit. Every question includes a written explanation of the correct answer.
Is this Node.js quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the beginner quiz aimed at?+
Modules, the runtime, file system basics and how Node differs from the browser — the groundwork every Node developer is expected to have.
Can I use this to prepare for a Node.js interview?+
Yes. The questions cover the topics that come up in Node.js technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your Node.js?
30 questions, 30 minutes. Free, no sign-up.
Start now