Node.js Communication & Stakeholder Relations 2 — Questions and Answers
Question 1: A product manager asks why the Node.js API occasionally returns 503 errors under load. Which approach best communicates the root cause?
- Tell them the server is broken
- Explain that the event loop is blocked by synchronous CPU-intensive tasks exceeding capacity (Correct answer)
- Say it's a network issue
- Blame the database
Correct answer: Explain that the event loop is blocked by synchronous CPU-intensive tasks exceeding capacity
Blocking the event loop with CPU-intensive synchronous code prevents Node.js from handling new requests, causing 503s under load.
Question 2: A stakeholder requests real-time order status updates in your Node.js application. Which technology should you recommend and why?
- REST polling every second
- WebSockets via the 'ws' library for persistent bidirectional communication (Correct answer)
- Email notifications
- Periodic database queries from the client
Correct answer: WebSockets via the 'ws' library for persistent bidirectional communication
WebSockets provide persistent bidirectional connections ideal for real-time updates without the overhead of repeated HTTP requests.
Question 3: Your team uses EventEmitter for internal service communication. A developer emits an event with no registered listener. What happens by default?
- Node.js throws a fatal error
- The event is queued until a listener registers
- The emission is silently ignored except for 'error' events which throw (Correct answer)
- The process exits
Correct answer: The emission is silently ignored except for 'error' events which throw
Unhandled events are silently discarded, but an unhandled 'error' event causes Node.js to throw an uncaught exception.
Question 4: A client complains that your API gives no useful error messages. Which Node.js practice best improves error communication?
- Always return HTTP 200 with an error field
- Return appropriate HTTP status codes with structured JSON error bodies including a message and error code (Correct answer)
- Log errors server-side only and return generic messages
- Return the full stack trace to the client
Correct answer: Return appropriate HTTP status codes with structured JSON error bodies including a message and error code
Returning proper HTTP status codes with structured error bodies gives clients actionable information without exposing sensitive internals.
Question 5: You need to notify stakeholders whenever a background Node.js job completes. Which pattern is most appropriate?
- Have stakeholders poll a status endpoint
- Use process.exit() with a status code
- Emit a custom event via EventEmitter or publish to a message queue like Redis Pub/Sub (Correct answer)
- Write a log file and tell them to check it
Correct answer: Emit a custom event via EventEmitter or publish to a message queue like Redis Pub/Sub
EventEmitter or a message queue decouples job completion notification from the job itself, enabling reliable stakeholder notification.
Question 6: A stakeholder wants API documentation auto-generated from your Express.js codebase. Which tool is most commonly used?
- JSDoc with @param tags only
- Swagger/OpenAPI via swagger-jsdoc and swagger-ui-express (Correct answer)
- README.md maintained manually
- Postman collections exported as HTML
Correct answer: Swagger/OpenAPI via swagger-jsdoc and swagger-ui-express
swagger-jsdoc parses JSDoc comments to generate OpenAPI specs, and swagger-ui-express serves interactive documentation automatically.
Question 7: During a sprint review, a non-technical stakeholder asks about your Node.js service's uptime. Which metric best communicates reliability?
- Number of npm packages installed
- Percentage uptime (e.g., 99.9%) with mean time between failures (Correct answer)
- Lines of code written
- Number of git commits
Correct answer: Percentage uptime (e.g., 99.9%) with mean time between failures
Uptime percentage and MTBF are universally understood reliability metrics that resonate with non-technical stakeholders.
A product manager asks why the Node.js API occasionally returns 503 errors under load.
Which approach best communicates the root cause?