Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 15 NodeJS Interview Questions for 2022

1) What is NodeJs?

NodeJs is open source JavaScript based feamework used to develop I/O intensive web application. It is collections of JavaScript library and runtime environment. It is used to develop server-side and networking applications.

2) What are the features on NodeJs?

These are the some important feature provided by NodeJs:
  • Asynchronous and Event Driven.
  • Fast code execution.
  • Single threaded.
  • No buffering
  • Great concurrency

3) What is REPL in NodeJs?

REPL (Read Eval Print Loop) represent a computer environment (window console or linux/unix shell) where some command is entered and system generates an output.
  • Read: Reads user input command, parses it to JavaScript data structure.
  • Eval: Evaluate the data structure.
  • Print: Prints the output result.
  • Loop: Circulate the above all commands until user press ctrl-c twice.

4) What is npm?

npm stands for Node Package Manager. It provide the following facilities:
  • It provides command line utility to install NodeJs packages.
  • It also manages version and dependency of NodeJs packages.
  • It provides online repositories facilities for NodeJs packages which are It provides online repositories facilities for NodeJs packages which are searchable on search.nodejs.org.

5) How NodeJs works?

NodeJs executes on v8 environment which act as virtual machine. This virtual machine utilizes JavaScript as its scripting language and generates output via non-blocking I/O and single threaded event loop.

6) Why Node.js is single threaded?

Nodejs is single-threaded as JavaScript executed in single thread with event loop. Event mechanism helps the server to respond in an asynchronous way and make server highly scalable.

7) Where can we use NodeJs?

NodeJs is used to build following type of applications:
  • Network application
  • Web application
  • Single Page application
  • Video (data) streaming application
  • Distributed systems

8) What does event-driven programming mean?

Event driven programming is a programming paradigm in which the flow of program is determined by events. In NodeJs event driven paradigm is maintain by event and callbacks. NodeJs uses an event loop and whenever a task gets finished, it calls the corresponding event.

9) What is EventEmitter?

EventEmitter is a class which lies in events module. It has multiple methods with event and listener. The following code represents how it can be accessed:
var events = require('event'); //import event module  

var eventEmitter = new events.EventEmitter(); //creating an object
Methods under EventEmitter class:
addListener(event, listener)

removeListener(event, listener)

removeAllListeners([events])

setMaxListeners(n)

listeners(events)

once(event, listener)

on(event, listener)

emit(event, [arg1],[arg2],[..])

10) What are the different types of API functions in NodeJs?

There are two types of API function in NodeJs:
  • Non-blocking (asynchronous) function.
  • Blocking (synchronous) function.

11) What is 'Callback' in NodeJs?

Callback is a function used to deal with multiple requests made to the server. A callback is called at the completion of assign task. Callback function allows server to deal with pending request first and call a function when it is completed.

12) What does it mean "non-blocking" in NodeJs?

Non-blocking code are those which doesn't wait for previous assign task to complete. Non-blocking code means that the IO is not blocking. Non-blocking code do not execute in sequence.

13) What is "blocking" function in NodeJs?

Blocking code refers when an application wait for some I/O operation in order to complete its execution. It wait for previous assign task to complete first when multiple task assign to server.

14) Which command is used to import external libraries?

"require" command is used to import external libraries. For example:
var http=require("http"); //load http library.  

var fs=require("fs"); // load external file.

15) Which is the most compatible framework used in NodeJs?

"ExpressJs" is most commonly framework used in node.js.