Node.js Cheat Sheet 2026

The 30 highest-yield Node.js facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

65 questions
120 min time limit
68.00% to pass
  1. What is the professional approach to structuring a large Node.js application to promote maintainability? Organize code into feature-based or layer-based modules with clear separation of concerns
  2. What does res.sendStatus(204) send to the client? Status 204 with the default status message as the body
  3. What is the purpose of calling next(err) inside an Express middleware? Passes control to the next error-handling middleware
  4. Which assertion style does Chai's `expect` interface use? Chainable getter-based natural language assertions
  5. What does 'graceful shutdown' mean in the context of a professional Node.js service? Stopping acceptance of new requests, finishing in-flight requests, then exiting cleanly
  6. In the Node.js event loop, the `check` phase is dedicated to executing callbacks registered by which function? setImmediate()
  7. _________ is a Node.js debugging tool with a graphical user interface. Node Inspector
  8. A stakeholder wants API documentation auto-generated from your Express.js codebase. Which tool is most commonly used? Swagger/OpenAPI via swagger-jsdoc and swagger-ui-express
  9. What is the purpose of `mongoose.connection.on('error', handler)` in a Node.js application? To catch post-connection errors such as network drops
  10. A Node.js service receives a JWT and verifies it using jwt.verify(token, secret). What risk does omitting the algorithms option introduce? Algorithm confusion attacks, including the 'none' algorithm bypass
  11. What does the caret (`^`) range in `"express": "^4.18.0"` allow? Any version >=4.18.0 and <5.0.0
  12. What event does a Readable stream emit after all data has been consumed and the stream has closed? 'end'
  13. Which Express built-in middleware parses URL-encoded form bodies? express.urlencoded()
  14. In the REPL session, the Underscore Variable is used to get the last result.
  15. What is the role of the `libuv` library in the Node.js architecture? Provides the event loop and async I/O abstractions across platforms
  16. What is the main purpose of Istanbul (nyc) in a Node.js project? To instrument JavaScript code and measure how much of it is covered by tests
  17. Which Node.js built-in module provides the `assert.deepStrictEqual()` method for comparing objects in tests? assert
  18. In Prisma, what command regenerates the Prisma Client after modifying `schema.prisma`? prisma generate
  19. Which async iteration construct should you use to consume a Node.js Readable stream line by line in modern Node.js? for await...of with the stream
  20. What does the `path.resolve()` method return? An absolute path by processing the sequence of paths from right to left
  21. What is a 'starvation' risk when using `process.nextTick()` recursively? It can prevent the event loop from ever reaching the I/O poll phase
  22. How do you view all globally installed npm packages? npm list -g --depth=0
  23. A Node.js stream pipeline processes compressed user uploads. What denial-of-service risk must be mitigated? Zip bombs: tiny compressed input expanding to gigabytes, exhausting memory
  24. What does setting `"strict": true` in a TypeScript `tsconfig.json` enable for QA purposes? A set of strict type-checking flags that catch more potential bugs at compile time
  25. What does `sinon.stub()` return when called without a replacement implementation? A stub that returns `undefined` by default
  26. What does the Node.js community consider a best practice for handling asynchronous errors in Express middleware? Passing errors to next(err) so Express's error-handling middleware can process them
  27. What is the output of this code? ``` async function main() { throw new Error('oops'); } main().catch(e => console.log(e.message)); ``` oops
  28. Which tool is commonly used to enforce consistent code formatting in Node.js projects? Prettier
  29. What is the default string encoding used when creating a Buffer from a string in Node.js? utf8
  30. What does the `--inspect` flag do when starting a Node.js application? Enables the V8 inspector protocol for debugging
Was this helpful?