Node JS Interview Questions and Answers Set 2

11. What Is Chaining Process In Node.Js?

It’s an approach to connect the output of one stream to the input of another stream, thus creating a chain of multiple stream operations.

12. What Are The Different Custom Directive Types In AngularJS?

AngularJS supports a no. of different directives which also depend on the level we want to restrict them.

So in all, there are four different kinds of custom directives.

  • Element Directives (E)
  • Attribute Directives (A)
  • CSS Class Directives (C)
  • Comment Directives (M)

13. Explain Child process module?

Child process module has following three major ways to create child processes –

  • spawn – child_process.spawn launches a new process with a given command.
  • exec – child_process.exec method runs a command in a shell/console and buffers the output.
  • fork – The child_process.fork method is a special case of the spawn() to create child processes.

14. 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.

15. Why to use exec method for Child process module?

“exec” method runs a command in a shell and buffers the output. Below is the command –

child_process.exec(command[, options], callback)

Weekend / Weekday Batch

16. What are “Streams” in Node.JS?

“Streams” are objects which will let you read the data from source and write data to destination as a continuous process.

17. What is the use of method – “spawn()”?

This method is used to launch a new process with the given commands. Below is the method signature –

child_process.spawn(command[, args][, options])

18. What you mean by JSON?

JavaScript Object Notation (JSON) is a practical, compound, widely popular data exchange format. This will enable JavaScript developers to quickly construct APIs.

19. What Is Local Installation Of Dependencies?

By default, npm installs any dependency in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present. Locally deployed packages are accessible via require(). To install a Node project locally following is the syntax.

C:Nodejs_WorkSpace>npm install express

20. What Is Package.json?

package.json is present in the root directory of any Node application/module and is used to define the properties of a package.