Best Online Tutorials

SQL Tutorial

Free SQL Tutorial

SQL Interview Questions

SQL Practice Questions

SQL Tips & Tricks

SQL Errors

SQL Books

Angular Tutorial

Free Angular Tutorial

Angular Interview Questions

Angular Practice Questions

Angular Tips & Tricks

Angular Errors

Angular Books

Node.js Tutorial

Free Node.js Tutorial

Node.js Interview Questions

Node.js Practice Questions

Node.js Tips & Tricks

Node.js Errors

Node.js Books

React.js Tutorial

Free React.js Tutorial

React.js Interview Questions

React.js Practice Questions

React.js Tips & Tricks

React.js Errors

React.js Books

SSIS Tutorial

Free SSIS Tutorial

SSIS Interview Questions

SSIS Practice Questions

SSIS Tips & Tricks

SSIS Errors

SSIS Books

SEO Tutorial

Free SEO Tutorial

SEO Interview Questions

SEO Practice Questions

SEO Tips & Tricks

SEO Errors

SEO Books

Javascript Tutorial

Free Javascript Tutorial

Javascript Interview Questions

Javascript Practice Questions

Javascript Tips & Tricks

Javascript Errors

Javascript Books

MongoDB Tutorial

Free MongoDB Tutorial

MongoDB Interview Questions

MongoDB Practice Questions

MongoDB Tips & Tricks

MongoDB Errors

MongoDB Books

Next.js Tutorial

Free Next.js Tutorial

Next.js Interview Questions

Next.js Practice Questions

Next.js Tips & Tricks

Next.js Errors

Next.js Books

Node.js Interview Questions and Answers | Part 12 

Prashant Surya  |   Jan 7, 2020  |  Views: 130
pictures

Description:

1. What ate the types of application you can build using Node Js ?


Using Node Js we can build the applications like:

Web Applications
Microservices / API’s
Internet of Things Applications
Real-Time Chats Applications
Complex Single-Page Applications
Real-Time Collaboration Tools
Streaming Applications



2. How to set the default node version using nvm?


By running the following command on the terminal to set default node version along multiple installed versions of node. 
You can list all install versions of the node by running 
nvm ls
nvm alias default v7.3.0

 3. How can we generate unique UUIDs/ guid in Node Js ?


Use node-uuid package to generate unique UUIDs/ guid in Node Js. Below code demonstrates how to generate it.

var uuid = require('node-uuid');
// Generate a v1 (time-based) id 
uuid.v1(); 
// Generate a v4 (random) id 
uuid.v4(); 


4. What is libuv in Node Js ?


libuv is Cross-platform I/O abstraction library that supports asynchronous I/O based on event loops.

It is written in C and released under MIT Licence.

It supports Windows IOCP, epoll(4), kqueue(2), and Solaris event ports. 

Initially, it was designed for Node.js but later it is also used by other software projects.


5. How Node js read the content of a file?


NodeJs reads the content of a file in non-blocking, asynchronous way. 
Node Js uses its fs core API module to deal with files. 
The easiest way to read the entire content of a file in nodeJs is with fs.readFile method. 

Example to read a file in NodeJs asynchronously and synchronously.

Reading a file in node asynchronously/ non-blocking
var fs = require('fs'); 
fs.readFile('DATA', 'utf8', function(err, contents) {
    console.log(contents);
});
console.log('after calling readFile');
Reading a file in node asynchronously/blocking
var fs = require('fs'); 
var contents = fs.readFileSync('DATA', 'utf8');
console.log(contents);


6. What is the revealing module pattern?


Revealing module pattern is similar to Module Pattern.
IT Exposes only the properties and methods you want via an returned Object.

var greeting = 'Hello world!'
function greet() {
 console.log(greeting)
}
module.exports = {
  greet: greet
}


7. What is JIT in Node JS ?


JIT stands for Just-in-time. 

A JIT compiler is a program which is used to send bytecode (it consists of instruction that can be interpreted) to the processor by converting it into instruction. 

After you have done with writing a program, the compiler compiles the source language statements into bytecode instead of compiling it into the code that carries the information which is similar to the specific hardware platform's processor.

Virtual machine of Nodejs has JIT compilation which improves the execution speed of the code. 

The virtual machine takes the source code and converts to machine code in runtime. 

By this, the hot functions which are called very often are compiled to machine code and, hence increasing speed.


8. How does Promise and Queue work?


Once a promise settles, or if it has already settled, it queues a microtask for its reactionary callbacks. 

This ensures that promise callbacks are async even if the promise has already been settled.

Promise keeps its callback to the queue for microtasks.

Promise itself is not kept in the stack, but the Promise then (callback) is added to the queue of Microtasks, which are processed after the stack becomes empty.

Promise are not "kept in the message queue", which contains only micro-tasks. The event loop knows nothing about promises. It merely picks micro-tasks off the queue for execution.


 

9. What does emitter do and what is dispatcher? 


Emitter fires the events for the defined action.
Dispatcher sends the action

 10. What Is Package.Json? Who Uses It?


It keeps the metadata relevant to the project.

npm uses this package.json file to specify the version of a package that your app depends on.

This file contains the custom scripts to be run with npm command.

It can be generated by:
npm init


Comments:
Content Contributor
Prashant Surya

Prashant Surya

Software developer at Uniserve Data Technologies Pvt. Ltd.  |   Noida, Uttar Pradesh, India

I am a software developer, freelancer and trainer working on technologies likes. MEAN stack, MERN Stack, ASP.NET full stack , SQL, JavaScript, jQuery, HTML, CSS, SEO, responsive UI/UX designing... having 7 years of experience in development in multiple domains like, eCommerce, capital markets, education, real estate...


Read related articles

Node.js Interview Questions and Answers | Part 5

Pooja Goel  |   Dec 30, 2019  |  Views: 207

Node.js Interview Questions and Answers | Part 4

Pooja Goel  |   Dec 30, 2019  |  Views: 260

Node.js Interview Questions and Answers | Part 3

Pooja Goel  |   Dec 30, 2019  |  Views: 151

Node.js Interview Questions and Answers | Part 2

Pooja Goel  |   Dec 27, 2019  |  Views: 107

Node.js Interview Questions and Answers | Part 1

Pooja Goel  |   Dec 27, 2019  |  Views: 301

Want to sell your software ?-

If you want to sell your readymade software to the genuine clients or businessman, list your software with details and demo links.

  • Sell ERP
  • Sell Website Clones
  • Sell App Clones
  • Sell Readymade Portals
  • Sell Readymade Websites
  • Sell Mobile Apps
  • Sell Window Apps

Clients will find it using our advanced search filter and will contact you directly.

No any charge for the product lsiting.

Do you own a Company ?+

Property.sale

Buy or Sell Commercial Property+

Are you a freelancer ?+

Looking for a job ?+

Are you a Service Provider ?+

Are you a blogger ?+

Do you own an IT Institute ?+


Property.sale