Very interesting set of non-standard Node.js interview questions for backend developers and for Node.js system software developers which were created by Timur Shemsedinov (CTO at QOTEQ, Salucyber, Metatech; Architect at Metarhia and Metactos; Lecturer at KPI, KSE). From my point of view you can use these questions during the interview and for preparation for the interview.
Today I am publishing the first part - 55 questions for Node.js backend developers.
- What can you do by using for await with request: IncomingMessage object?
- How can you hash passwords in Node.js and when you need to use third-party dependencies for it?
- Which API implements nodejs/undici?
- What can you use instead of node:domain API?
- When can we use synchronous operations with files from node:fs instead of asynchronous operations and what to pay attention to taking this decision?
- Explain the best practices for processing the errors in asynchronous code.
- How vulnerabilities can appear in projects on Node.js? Explain please, what are XSS, Path traversal, SQL injection, CSRF? How can we protect apps from these?
- What do you know about race condition in asynchronous programming? How can we protect from it?
- Pros and cons dividing the code on .js and .d.ts.
- Tell please several typical Node.js patterns (according to GoF and not only) with examples.
- Explain the problem of the fat controllers (with examples on Node.js).
- Tell please some examples of the leaky abstractions (typical for Node.js).
- How to create a Singleton by using the module system in Node.js.
- How to easier implement the Strategy pattern on JavaScript and where to use it in Node.js?
- Give an example of Adapter pattern from core Node.js libraries (there are several).
- Which design pattern is implement the EventEmitter?
- Explain relationship between EventEmitter and Readable contracts.
- What antipatterns (or examples of bad style) of programming for Node.js can you give?
- Why do these Error fields need: error.cause, error.code, error.message, error.stack?
- How can you copy a folder with subfolders and files using node:fs?
- Can we make real-time applications by using Node.js?
- What approaches do you know for Logging? Differences, pros and cons.
- Where do we need to store secrets (api keys, tokens, passwords for Database, etc.)?
- How do not block all users during the processing of a request from one of them?
- Why do we need to do return await inside asynchronous functions and methods instead of returning a Promise?
- What do we need to do if during the request processing we need to abort the process (though it processes a lot of requests in parallel)?
- Which programming styles and paradigms do you use in Node.js applications? Why?
- Which weak sides of Node.js do you know? What is bad or impossible to write on Node.js?
- What is the difference between stateful and stateless approaches for Node.js applications? How can we choose between them?
- How can you limit the throughput of an endpoint (the number of requests per unit of time)?
- What are dangerous mixins for the application code (with typical examples on Node.js)?
- How do you implement the layered architecture in Node.js applications?
- What is Dependency Injection and how to implement it in Node.js (it is desirable to make it several ways)?
- Why is middleware an antipattern? How can we write code without one?
- How can we reduce code coupling in Node.js applications?
- Why do we need to add node: prefix during the loading core modules?
- Why do you need an AbortController? Give several examples AbortController is using.
- JSON serialization and deserialization can work a long time and can block a thread. What do you do with it?
- Why can all database connections leak from the Database connection pool and how to prevent this situation?
- How do you implement a data access layer?
- What is the advantage of the async/await and promises over callbacks in Node.js? Where is it impossible to do without a callback?
- What will you do if in two places of the one application you need different versions of the npm dependencies?
- Which Web API was added to Node.js during the last time and why?
- What can you use instead of outdated pm2 and forever in a modern world?
- How can a business logic be independent from a framework or a protocol through which requests come?
- Why do we not need axios, request, node-fetch in Node.js applications?
- Why do we need to use queues inside applications and external MQ systems?
- What is it bad when the dependency patches global objects, classes, prototypes?
- What is Node.js LTS and which benefits it gives to us?
- Why do we need to use Websocket? Why is using socket.io in 2023 a bad practice and what we need to use by working with Websocket?
- What does the --watch flag?
- In what condition is the native test runner in Node.js?
- Can we create an app as a single executable file in Node.js? How and why?
- What ways to track the asynchronous contexts do you know? Are they necessary at all?
- When and how do we need to update Node.js versions at apps?