Nodejs Interview Questions And Answers

nodejs interview questions and answers   Top 16 Nodejs Interview Questions And Answers

1) What is Node JS?

It is an open source software which uses Javascript on the server.
It is compatible with different operating system platforms.

2) What is the key feature of Node JS?

It uses asynchronous programming along with that it uses single thread which increases memory efficiency. Also it created dynamic pages.

3) In NodeJS what are the modules?

These are the libraries having set of functions that can be included in the app.

4) How to include modules in NodeJS?

This can be included using require() function.


5) How to create user define modules in NodeJS?

It is easy to create your own modules. Here is the example: = function(){
return x;
Save this in modl.js

This module can be included as below:

var temp = require('./modl');;

6) In NodeJS how we can create HTTP server?

There is one method called as createServer() which is used to create HTTP server.

7) What is file server in NodeJS?

It is used to work with file systems on computer.

fs = require('fs');

Following are the common uses of fs module:
● Create files
● Read files
● Update files
● Delete files
● Rename files

8) In NodeJS, which of the following methods are not the part of create files?
a. fs.appendFile() b. c. fs.readFile() d. fs.writeFile()

Answer is c

readFile() is a part of Read Files module and not the part of create files.

9) What is NPM in NodeJS?

NPM is package manager for different packages and modules.

10) What are the packages in NodeJS?

It contains files for the modules.

11) what are the different functionalities of NPM in Node JS?

Following are the functionalities of NPM:
● These are the online Repository for many packages.
● These are the command line utilities for other packages.

12) What are the events in NodeJS?

Every action that has been performed is an event. Node JS has built-in module called as Event.

13) What is an EventEmitter object in Node JS?

Event handlers can be assigned using this EventEmitter object.

14) Which module works with uploading file in Node JS?

Formidable module is good to work with file uploads.

15) Which module works to send email in Node JS?

Nodemailer Module

16) What is callback in Node JS?

This function can be called at completion of a given task.