• +91 9723535972
  • info@interviewmaterial.com

NodeJS Interview Questions and Answers

NodeJS Interview Questions and Answers

Question - 81 : - Command to list modules installed in current npm

Answer - 81 : -

$ npm ls

Note: Remember not to mention npm in UPPERCASE - (Recommended)

Question - 82 : - Mention types of npm modules available that are used very often.

Answer - 82 : -

Express, connect, socket.io and SockeJS, pug, MongoDB and Mongojs, Redis, Lodash, forever, bluebird, moment are some of the npm modules.

Question - 83 : - Syntax to install modules using NPM.

Answer - 83 : -

Syntax : $ npm install

Example: 

$ npm install express
var express = (‘express’);
Where express is the Name of the module,
express is a JS file, that can be used in your module.

Question - 84 : - Since the node is a single-threaded process, how to make use of all CPUs?

Answer - 84 : -

The node js is single-threaded but the node name itself suggests that it is a topology, which means there is communication between two nodes. This communication between the two nodes makes use of all CPUs.

Question - 85 : - What does an emitter do and what is a dispatcher?

Answer - 85 : -

The emitter is one that makes communication between two nodes.

When the job of the scheduler is completed in a program then dispatched comes into the frame and takes the task to the desired status.

Question - 86 : - How to stop the master process without suspending all of its child processes?

Answer - 86 : -

Upstart is a process management system with which you can stop the master process. Generally when the master process is stopped or killed the child process still continues to work.

Question - 87 : - Difference between the cluster and child_process modules?

Answer - 87 : -

A cluster is when one master program is running two or more nodes at a single running time.
A child process simply starts a new script on the system, it is quite similar to the cluster but in a different language.

Question - 88 : - Do you have any experience working in the same industry like ours?

Answer - 88 : -

With this question, the interviewer is trying to assess if you’ve had any previous work experience or internship experience where you dealt with similar working environments or technologies. This line of questioning can be easily answered based on your previous experiences. Make sure to keep it concise and detailed as required when answering this question.

Question - 89 : - What is the use of EventEmitter in Node.js?

Answer - 89 : -

Every single object in Node.js that emits is nothing but an instance of the EventEmitter class. These objects have a function that is used to allow the attachment between the objects and the named events.

Synchronous attachments of the functions are done when the EventEmitter object emits an event.

Question - 90 : - How does the DNS lookup function work in Node.js?

Answer - 90 : -

The DNS lookup method uses a web address for its parameter and returns the IPv4 or IPv6 record, correspondingly.

There are other parameters such as the options that are used to set the input as an integer or an object. If nothing is provided here, both IPv4 and IPv6 are considered. The third parameter is for the callback function.

The syntax is:

dns.lookup(address, options, callback)


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners