Node JS Interview Questions
1 .
What Is Node.js ?
Node.js is a powerful framework developed on Chrome’s V8 JavaScript engine that compiles the JavaScript directly into the native machine code. It is a lightweight framework used for creating server-side web applications and extends JavaScript API to offer usual server-side functionalities. It is generally used for large-scale application development, especially for video streaming sites, single page application, and other web applications.
2 .
Why use Node.js ?
Node.js makes building scalable network programs easy. Some of its advantages include:
* It is generally fast
* It almost never blocks
* It offers a unified programming language and data type
* Everything is asynchronous 
* It yields great concurrency
3 .
How do Node.js works ?
Node.js is a virtual machine that uses JavaScript as its scripting language and runs on a v8 environment. It works on a single-threaded event loop and a non-blocking I/O which provides high rate as it can handle a higher number of concurrent requests. Also, by making use of the ‘HTTP’ module, Node.js can run on any stand-alone web server. 
4 .
Why Node.js is single threaded ?
Node.js uses a single threaded model in order to support async processing. With async processing, an application can perform better and is more scalable under web loads. Thus, Node.js makes use of a single-threaded model approach rather than typical thread-based implementation.
5 .
How many types of API functions are there in Node.js ?
There are two types of API functions in Node.js:
* Asynchronous, non-blocking functions
* Synchronous, blocking functions
6 .
Explain callback in Node.js.
A callback function is called after a given task. It allows other code to be run in the meantime and prevents any blocking.  Being an asynchronous platform, Node.js heavily relies on callback. All APIs of Node are written to support callbacks.
7 .
How would you define the term I/O ?
* The term I/O is used to describe any program, operation or device that transfers data to or from a medium and to or from another medium

* Every transfer is an output from one medium and an input into another. The medium can be a physical device, network, or files within a system
8 .
How is Node.js most frequently used ?
Node.js is widely used in the following applications:
* Real-time chats
* Internet of Things
* Complex SPAs (Single-Page Applications)
* Real-time collaboration tools
* Streaming applications
* Microservices architecture
9 .
What is NPM ?
NPM stands for Node Package Manager, which is responsible for managing all the packages and modules for Node.js.
Node Package Manager provides two main functionalities:
* Provides online repositories for node.js packages/modules, which are searchable on

* Provides command-line utility to install Node.js packages, and also manages Node.js versions and dependencies
10 .
What is the command used to import external libraries ?
The “require” command is used for importing external libraries. For example:   “var http=require (“http”)”.  This will load the http library and the single exported object through the http variable.