Common Node.js interview questions and answers for fresher & experienced

Common Node.js interview questions and answers for fresher & experienced
In this post We’ll discuss about some Common Node.js interview questions and answers for fresher & experienced, If your are a node.js developer or just started learning node.js and want to switch your career as node.js developer then these common node.js interview question and answer will help you to crack job interview as node developer.
Node.js-interview-questions-and-answers

Common Node.js interview questions and answers for fresher & experienced



Question: What is Node.js?

Node.js is a very powerful JavaScript based framework built on Google Chrome’s JavaScript Engine(V8 Engine).Node.js is a Server side scripting which is used to build scalable programs. Its multiple advantages over other server side languages, the prominent being non-blocking I/O.

Question: In which language Node.js is written?

C,C++, javaScript.

Question: What do you mean by the term I/O?

I/O is the shorthand for input and output, and it will access anything outside of your application. It will be loaded into the machine memory to run the program, once the application is started.


Question: Who developed Node.js & When?

Node.js was developed in 2009 by Ryan Dahl.

Question: How node.js works?

Node.js works on a v8 environment, it is a virtual machine that utilizes JavaScript as its scripting language and achieves high output via non-blocking I/O and single threaded event loop.

Question: Is Node a single threaded application?

Yes! Node uses a single threaded model with event looping.

Question: What is Advantage of Node.js?

Following are the advantages of Node.js.
* It provides an easy way to build scalable network programs.
* Faster in processing
* Generally fast
* Event driven and Asynchronous
* Single Threaded but highly Scalable

Question: What are two different types of API functions in Node.js?

1) Asynchronous, non-blocking functions
2) Synchronous, blocking functions

Question: What is REPL in Node.js?

REPL stands for Read Eval Print Loop. Node.js comes with bundled REPL environment which performs following tasks.
* Eval
* Print
* Loop
* Read


Question: What is control flow function?

A generic piece of code which runs in between several asynchronous function calls is known as control flow function.

Question: What is the command to stop REPL in Node.js?

Use ctrl + c command twice to stop REPL.

Question: What is npm?

npm stands for Node Package Manager. which help to install node.js packages/plugins Command line, also does version management and dependency management of Node.js packages.

Question: How to get Post Data in Node.js?

app.post('/', function(request, response){
    console.log(request.body);
 
});

Question: How to get npm version in node.js?

npm --version

Question: What is the command to check the already installed dependencies which are globally installed using npm?

npm ls -g

Question: What is callback in Node.js?

Callback is called once the asynchronous operation has been completed. Node.js heavily uses callbacks and all API’s of Node.js are written to support callbacks.


Question: Explain Package.JSON?

This will be present in the root directory of any Node module and will be used to define the properties of a package. and help to install packages from npm.
Eg: Package.json

{
  "name": "NodeJs-Mysql",
  "version": "0.0.1",
  "description": "NodeJs with mysql connectivity",
  "dependencies": {
    "express": "^4.13.1",
    "mysql": "^2.8.0"
  }
}

Question: Does node run on windows?

Yes

Question: Can you access DOM in node?

No, you cannot access DOM in node.

Question: Explain FS module ?

FS stands for “File System” and fs module is used for File I/O. You can include FS module by following way.

var fsLib = require("fs");

Question: Explain Console in Node.JS?

“Console” is a global object and will be used for printing to stderr and stdout and this will be used in synchronous manner in case of destination is either file or terminal or else it is used in asynchronous manner when it is a pipe.

Question: Explaine OS module in Nodejs?

OS module is used for some basic operating system related utility functions. Below is the syntax for including OS module in nodejs

var osLib = require("os");

Question: Explain Path module in Node.JS?

Path module will be used for transforming and handling file paths. Below is the syntax of path module

var pathlib = require("path");