Node.js / NestJS

Node.js Fundamentals

Event loop, non-blocking I/O, CommonJS/ES6 modules, package.json, npm/yarn

20 питань зі співбесід·
Junior
1

What is the event loop in Node.js?

Відповідь

The event loop is the central mechanism in Node.js that enables asynchronous execution. It monitors the call stack and callback queue, executing callbacks when the call stack is empty. This mechanism allows Node.js to handle thousands of simultaneous connections without creating additional threads, making the model very efficient for I/O operations.

2

What is the main characteristic of Node.js I/O model?

Відповідь

Node.js uses a non-blocking, asynchronous I/O model. When an I/O operation is initiated (file read, network request), Node.js doesn't wait for its completion and continues executing other tasks. Once the operation completes, a callback is added to the queue. This model enables excellent performance for applications with many concurrent I/O operations.

3

What is the main difference between require() and import?

Відповідь

require() is CommonJS syntax, loaded synchronously at runtime. import is ES6 modules syntax, statically analyzed before execution. ES6 modules enable tree-shaking (dead code elimination) and offer better optimization. CommonJS remains widely used for compatibility, while ES6 modules is becoming the modern standard.

4

What is the purpose of package.json file?

5

What is the role of the node_modules folder?

+17 питань зі співбесід

Опануй Node.js / NestJS для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно