Original practice questions written by SynfraCore, not real exam questions. 20 questions, free, no login required — your score is kept in this browser tab only and resets if you reload.
1. Why doesn't a long-running synchronous CPU computation in Node.js block OTHER requests on a multi-process server, but DOES block them on a single Node.js process?
Event Loop
2. What's the practical difference between `setTimeout(fn, 0)` and `process.nextTick(fn)` in terms of timing?
Event Loop
3. Why is `fs.readFileSync` generally discouraged in a Node.js server's request-handling code path?
Modules
4. What's the key practical difference between CommonJS (`require`) and ES Modules (`import`) in Node.js?
Modules
5. What does `module.exports = { foo, bar }` do in a CommonJS file?
Streams
6. Why would piping a large file with `fs.createReadStream().pipe(fs.createWriteStream())` be preferred over reading the whole file into memory first and then writing it out?
Streams
7. In Node.js stream terminology, what's the difference between a Readable stream and a Writable stream?
fs
8. What's the practical difference between `fs.readFile` (callback-based) and `fs.promises.readFile`?
fs
9. Why does an error-first callback like `fs.readFile(path, (err, contents) => { ... })` check `err` before using `contents`?
http
10. What does Node's built-in `http` module provide that a framework like Express is built ON TOP of, not instead of?
http
11. In a raw `http.createServer((req, res) => { ... })` handler, what does calling `res.end()` without any argument do?
Error Handling
12. Why does an `async` function's thrown error need to be caught with `try`/`catch` (or `.catch()` on the returned Promise), rather than a plain surrounding `try`/`catch` around where it's CALLED without awaiting it?
Error Handling
13. What does listening for `process.on("unhandledRejection", ...)` help catch?
Error Handling
14. Why is `throw` inside a plain (non-Promise-returning) synchronous callback passed to an async API often a mistake?
Modules
15. What problem does `npm ci` solve that a plain `npm install` doesn't guarantee as strictly?
Streams
16. What does 'backpressure' mean in the context of Node.js streams?
Event Loop
17. Why does Node's `cluster` module (or running multiple processes) help a CPU-bound Node.js application scale across multiple cores, when a single process can't?
http
18. What's the main reason a request body needs to be read as a stream of data chunks in a raw `http` server, rather than being available as a single value immediately?
Modules
19. What's the difference between a 'dependency' and a 'devDependency' in package.json?
Error Handling
20. What's the risk of swallowing an error with an empty `catch (err) {}` block instead of handling or re-throwing it?