Commonly Asked Node.js Interview Questions

Sunjid Hasan
2 min readJul 6, 2021

What Is Node.js?

Node.js is an open source server environment , Node. js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node. js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Why Node.js is single threaded?

The theory was that doing async processing on a single thread could provide more performance and scalability under typical web loads than the typical thread-based implementation.

Where Node.js can be used?

Node. js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It’s used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.

How many types of API functions are there in Node.js?

The two types of API functions in Node. js are: Asynchronous, non-blocking functions. Synchronous, blocking functions.

What is package.json?

The package. json file is the heart of any Node project. It records important metadata about a project which is required before publishing to NPM, and also defines functional attributes of a project that npm uses to install dependencies, run scripts, and identify the entry point to our package.

What do you understand by Event-driven programming?

An event-driven application is a computer program that is written to respond to actions generated by the user or the system. … Event-driven programming separates event-processing logic from the rest of a program’s code.

What is an Event loop in Node.js and how does it work?

The event loop is what allows Node. js to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible. Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background.

Explain REPL in the context of Node.js.

The Node.js Read-Eval-Print-Loop (REPL) is an interactive shell that processes Node.js expressions. The shell reads JavaScript code the user enters, evaluates the result of interpreting the line of code, prints the result to the user, and loops until the user signals to quit.

--

--