Node JS Interview Questions and Answers Set 5

41. 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 mypath = require(“path”)

42.What are the advantages of NodeJS?

Below are the list of advantages of NodeJS –

  • Javascript – It’s a javascript which can be used on frontend and backend.
  • Community Driven – NodeJS has great open source community which has developed many excellent modules for NodeJS to add additional capabilities to NodeJS applications.

43.Explain “Stub”?

Stub is a small program, which substitutes for a longer program, possibly to be loaded later and that is located remotely. Stubs are functions/programs that simulate the behaviors of components/modules.

44.How we can convert Buffer to JSON?

The syntax to convert Buffer to JSON is as shown beow

buffer.toJSON()

45.Explain “Net” module in Node.JS?

“Net” module is being used for creating both clients and servers. It will provide asynchronous network wrapper. Below is the syntax of Net module –

var mynet = require(“net”)

NODE JS & CERTIFICATION
Weekend / Weekday Batch

 46.List out the differences between AngularJS and NodeJS?

AngularJS is a web application development framework. It’s a JavaScript and it is different from other web app frameworks written in JavaScript like jQuery. NodeJS is a runtime environment used for building server-side applications while AngularJS is a JavaScript framework mainly useful in building/developing client-side part of applications which run inside a web browser.

47.How to concatenate buffers in NodeJS?

The syntax to concatenate buffers in NodeJS is

var MyConctBuffer = Buffer.concat([myBuffer1, myBuffer2]);

48.Why to use “ClearTimeout” in Node.JS?

This is the global function and it is used to stop a timer which was created during “settimeout()”.

49.Explain “NewListener” in Node.JS?

This event is being emitted whenever any listener is added. So when event is triggered the listener may not have been removed from listener array for the event.

50.Explain RESTful Web Service?

Web services which uses REST architecture will be known as RESTful Web Services. These web services uses HTTP protocol and HTTP methods.