Blog

Node.JS Interview Questions And Answers

  • (4.0)
  • | 3647 Ratings

Node JS Interview Questions and Answers

Last Updated: May 8th, 2018

If you're looking for Node.JS Interview Questions for Experienced or Beginners, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research Node.JS has a market share of about 2.6%. So, You still have opportunity to move ahead in your career in Node.JS Development. Mindmajix offers Advanced Node JS Interview Questions 2018 or node js programming interview questions that helps you in cracking your interview & acquire dream career as Node.JS Developer.

Learn more about our Node.JS Training Videos to get ahead in your career.

Node JS Interview Questions And Answers

Q) Node JS Vs Ruby

Feature Node JS Ruby On Rails
Written In C, C++, JavaScript Ruby
Operating System Solaris, OpenBSD,  FreeBSD, Linux, Mac, MS, webOS and nonStopOS Cross-Platform
Type Event driven networking Web application framework
License MIT MIT
Performance High Low
Popularity Popular for its features Yet to be popular
Documentation Available Lack of documentation
Concistency Inconsistent Consistent structure
Complexity Easy to implement Complex implementation

Q1) What is NodeJS?

NodeJS is javascript runtime environment that is built on chrome to enable lightweight and effective performance of server-side and networking applications in javascript.

Q2) What is NPM?

Node Package Manager. It is used to provide command line environment to install and manage NodeJS Packages, and NodeJS repositories that can be accessed at search.nodejs.org

Q3) Syntax to install modules using NPM.

Syntax : $ npm install

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

Q4) Mention types of npm modules available that are used very often.

Express, connect, socket.io and socketjs, pug, mongodb and mongojs, redis, lodash, forever, bluebird, moment are some of npm modules.

Q5) Command to list modules installed in current npm.

$ npm ls

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

Q6) What are the attributes of package.json

Name, version, description, homepage, author, contributors, dependencies − list of dependencies, repository − repository type and URL of the package, main − entry point of the package, keywords.

Q7) What is REPL?

REPL - Read, Eval, Print, Loop.
It is an environment to input commands to perform REPL tasks. Each of the task is associated with its respective operations.

Q8) What kind of applications can be built by Node.JS.

DIRT, JSON, I/O Bound, Single Page applications are preferable to use Node.JS.

Q9) What is the latest version of Node JS.

Node v8.0.0 is the current version.

Q10) NodeJS is a framework. True or False.

False. It is runtime or environment, but not a framework.

 

Learn Node.JS Tutorial

Q11) Commands to work with the file from the local database.

Var fs = require(‘fs’);

  • Read: fs.readFile();
  • Create:
    • fs.appendFile();
    • fs.open();
    • fs.writeFile();
  • Write: fs. writeFile();
  • Delete: fs.unlink();
  • Rename: fs.rename();
  • Update:
    • fs.appendFile()
    • fs.writeFile()

Q12) What is error-first callback in Node JS?

In order to check for proper working of the code, we need to verify error free execution. In this regard, error-first callbacks are used, that will send error first, followed by related data to the error.

Q13) What is cluster?

Cluster is a process to handle thread execution load while working with multi-core systems.

Q14) Why node is single threaded?

In order to upgrade the performance well, single thread operations work better than multi-threaded operations. 

Q15) How does URL module works.

This module helps URL to parse it into host, pathname, search, query, etc.

Example:
var url = require('url');
var adr = 'https://mindmajix.com/?s=node+js+training';
var q = url.parse(adr, true);
console.log(q.host); //returns 'mindmajix.com'
console.log(q.search); //returns '?s=node+js+training'

Q16) Explain use of nodemailer module.

It is not included in default modules list, it has to be installed using npm.
Var nodemailer = require(‘nodemailer’);

Q17) What are the types of versions available?

Patch_Version, Minor_Version, Major_Version.

Q18) What are event emitters in NodeJS?

Objects in NodeJS will have to trigger events in order to maintain asynchronous execution of core API used. These objects that emit events are known as Event Emitters.

Q19) What are event listeners?

Events that are emitted by event emitters have to be listened in order to continue the asynchronous execution of the threads. These objects that listens the emitted events are known as listeners.

Explore Node.JS Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!