Node.JS Interview Questions And Answers
Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Now a days NodeJs is very popular in the industry so, if you want to get hired in NodeJS interview, at least you should have good knowledge of Nodejs. Here we have collected some frequently asked questions of Nodejs. I hope you will get some help from these questions with answers.
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. Node.js is a web application framework built on Google Chrome's JavaScript Engine (V8 Engine).
Node.js = Runtime Environment + JavaScript Library
Q2) What is NPM?
Node Package Manager(NPM). 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.
NodeJS is javascript runtime environment that is built on chrome to enable lightweight and effective performance of server-side and networking applications in javascript. Node.js is a web application framework built on Google Chrome's JavaScript Engine (V8 Engine).
Node.js = Runtime Environment + JavaScript Library
Q2) What is NPM?
Node Package Manager(NPM). 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');
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.
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
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.
I got lot of ideas after reading this. Share more as similar to this. Thank you for shared this.
ReplyDeleteC C++ Training in Chennai
C Training in Chennai
C++ Training in Chennai
JMeter Training in Chennai
JMeter Training Institute in Chennai
Appium Training in Chennai
javascript training in chennai
core java training in chennai
keep up the good work. this is an Ossam post. This is to helpful, i have read here all post. i am impressed. thank you. this is our courses in data analytics
ReplyDeletecourses in data analytics | https://www.excelr.com/data-science-course-training-in-mumbai