Node JS Interview Questions and Answers Set 1

1.What is Node.js?

Node.js is a very powerful JavaScript based platform or framework which is built on Google Chrome’s JavaScript V8 Engine. This runtime allows executing the JavaScript code on any machine outside a browser.

2.Why to use Node.js?

It is used to develop I/O intensive web applications like video streaming sites, single page applications (SPA) and other web applications. Node.js is open source and used by thousands of developers around the world.

3.What Do You Mean By Asynchronous Api?

All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

4.What are the features of Node.js?

Below are the features of Node.js,

  • Very Fast
  • Event driven and Asynchronous
  • Single Threaded but highly Scalable

5. List out some REPL commands in Node.js?

Below are the list of REPL commands –

  • Ctrl + c – For terminating the current command.
  • Ctrl + c twice – For terminating REPL.
  • Ctrl + d – For terminating REPL.
  • Tab Keys – list of all the current commands.
  • .break – exit from multiline expression.
  • .save with filename – save REPL session to a file.

Weekend / Weekday Batch

6.Explain NPM in Node.js?

NPM stands for Node Package Manager (npm) and there are two functionalities which NPM takes care of mainly and they are –

  • Online repositories for node.js modules or packages, which can be searched on
  • Dependency Management, Version Management and command line utility for installing Node.js packages.

7.How Node.js can be made more scalable?

Node.js works good for I/O bound and not CPU bound work. For instance if there is a function to read a file, file reading will be started during that instruction and then it moves onto next instruction and once the I/O is done or completed it will call the callback function. So there will not be any blocking.

8.Explain REPL in Node.js?

REPL stands for Read Eval Print Loop. Node.js comes with bundled REPL environment which performs the following desired tasks –

  • Eval
  • Print
  • Loop
  • Read

9.How To Get Post Data In Node.Js?

Following is the code snippet to fetch Post Data using Node.js.

app.use(express.bodyParser());‘/’, function(request, response){



10.What Is The Global Installation Of Dependencies?

Globally installed packages/dependencies are stored in <user-directory>/npm directory. Such dependencies can be used in CLI (Command Line Interface) function of any node.js, but cannot be imported using require() in the Node application directly.

To install a Node project globally use -g flag as.

C:\Nodejs_WorkSpace>npm install express -g