Node.js Essentials Interview Question-Answers

Node.js Essentials Interview Question-Answer

Q.1 What npm stands for?

       A. Node Project Manager

       B. Node Package Manager

       C. New Project Manager

       D. New Package Manager

Ans : Node Package Manager


Q.2 Which of the following is true about Node.js?

       A. Node.js is used to develop I/O intensive web applications like video streaming sites, single page applications, and other web application

       B. Node.js is a JavaScript-based framework/platform built on Google Chrome’s JavaScript V8 Engine

       C. Node.js is open source and is entirely free to use

       D. All the options

Ans : All the options

Click here to read more Technical Q&A


Q.3 What is Node.js?

       A. Node.js is a Java-based framework

       B. Node.js is a web server

       C. Node.js is a JavaScript-based framework/platform built on Google Chrome’sJavaScript V8 Engine

       D. None of the options

Ans : Node.js is a JavaScript-based framework/platform built on Google Chrome’sJavaScript V8 Engine

Click here to read other blogs


Q.4 REPL stands for ____________________.

       A. Read Eval Point Loop

       B. Read Earn Point Learn

       C. Read Eval Print Loop

       D. Research Eval Program Learn

Ans : Read Eval Print Loop


Q.5 What is the use of Underscore Variable in REPL session?

       A. To get the last result

       B. To get the last command used

       C. To store the result

       D. None of the options

Ans : To get the last result


Q.6 How are node-based web servers different from traditional web servers?

       A. Node-based server processes request much faster than a traditional server

       B. There is no much difference between the two

       C.
Node-based server uses a single threaded model and can service a much larger number of requests than traditional server like Apache HTTP Server

       D. None of the options

Ans : 
Node-based server uses a single threaded model and can service a much larger number of requests than traditional server like Apache HTTP Server


Q.7 Print the directory name of your script using the predefined global object _____________.

       A. console.log( __dirname );

       B. console.log(/directoryname)

       C. console.log(‘dirname’)

       D. console.log( __directoryname );

Ans : console.log( __dirname );


Q.8 Print the relative path of your script using the predefined global object _____________.

       A. console.log( __filename );

       B. console.log(/filename)

       C. console.log(‘filename’)

       D. console.log( __dirname ); 9)

Ans : console.log( __filename );


Q.9 Print the relative path of your script using the pre defined global object

       A. console.log( __filename );

       B. console.log(/filename)

       C. console.log(‘filename’)

       D. console.log( __dirname ); 9)

Ans : console.log(‘filename’)


Q.10 We can get an http module in a node based application using _______.

       A. import http;

       B. package http;

       C. var http = import(“http”);

       D. var http = require(“http”);

Ans : var http = require(“http”);


Q.11 Which method of fs module is used to close a file?

       A. fs.closePath(fd, callback)

       B. fs.closeFile(fd, callback)

       C. fs.close(fd, callback)

       D. None of the options

Ans : fs.close(fd, callback)


Q.12 Which of the following is true about EventEmitter.on property?

       A. It is used to bind a function with the event

       B. None of the options

       C. It is used to locate an event handler

       D. It is used to fire an event

Ans : It is used to bind a function with the event


Q.13 Which method of fs module is used to truncate a file?

       A. fs.delete(fd, len, callback)

       B. fs.ftruncate(fd, len, callback)

       C. fs.remove(fd, len, callback)

       D. None of the options

Ans : None of the options


Q.14 Which method of fs module is used to write a file?

       A. fs.writePath(path, flags[, mode], callback)

       B. fs.write(path, flags[, mode], callback)

       C. fs.writeFile(path, flags[, mode], callback)

       D. None of the options

Ans : fs.writeFile(path, flags[, mode], callback)


Q.15 Which of the following is true about EventEmitter.emit property?

       A. It is used to locate an event handler

       B. It is used to fire an event

       C. It is used to bind a function with the event

       D. None of the options

Ans : It is used to fire an event


Q.16 Which of the following is true about Piping streams?

       A. Piping is used to get data from one stream and to pass the output of that stream to another stream

       B. There is no limit on piping operations

       C. Piping is a mechanism where we provide the output of one stream as the input to another stream

       D. All the options

Ans : All the options


Q.17 Which of the following is true about a readable stream? (I) A readable stream is used for read operation. (II) The output of a readable stream can be the input to a writable stream.

       A. I & II

       B. I

       C. II

       D. None of the options

Ans : I & II


Q.18 A stream fires end event when there is no more data to read.

       A. True

       B. False

Ans : True


Q.19 A stream fires a data event when there is data available to read.

       A. True

       B. False

Ans : True


Q.20 Each type of Stream is an EventEmitter.

       A. True

       B. False

Ans : True


Q.21 Which of the following is true about a writable stream? (I) A writable stream is used for write operation. (II) The output of a readable stream can be the input to a writable stream.

       A. I & II

       B. II

       C. I

       D. None of the options

Ans : I & II


Q.22 Which of the following is true about console global object?

       A. Console is used in an asynchronous way when the destination is a pipe

       B. Console is used in a synchronous way when the destination is a file or a terminal

       C. There are built-in methods to be used for printing informational, warning and error messages in console

       D. All of these

Ans : All of these


Q.23 Which of the following is true about setTimeout(cb, ms) global function? (I) The setTimeout(cb, ms) global function is used to run callback cb after at least ms milliseconds. (II) The setTimeout(cb, ms) function returns an opaque value that represents the timer which can be used to clear the timer.

       A. II

       B. I & II

       C. I

       D. None of the options

Ans : I & II


Q.24 Which of the following is true about __dirname global object? (I) The __dirname represents the name of the directory that the currently executing script resides in. (II) The __dirname represents the resolved absolute path of code file.

       A. II

       B. I & II

       C. I

       D. None of the options

Ans : I


Q.25 Which of the following commands will show all the modules installed globally?

       A. $ npm ls -g

       B. $ node ls

       C. $ npm ls

       D. $ node ls -g

Ans : $ npm ls -g


Q.26 Which of the following modules is required for operating system specific operations?

       A. os module

       B. net module

       C. fs module

       D. None of the options

Ans : os module


Q.27 Which of the following modules is required for path specific operations?

       A. path module

       B. net module

       C. fs module

       D. None of the options

Ans : path module


Q.28 Which of the following provides in-built events?

       A. throw

       B. callback

       C. handler

       D. events

Ans : events


Q.29 How are node-based web servers different from traditional web servers?

       A. Node-based server uses a single threaded model and can service a much larger number of requests than traditional server like Apache HTTP Server

       B. There is no much difference between the two

       C. Node-based server processes request much faster than a traditional server

       D. None of the options

Ans : Node-based server uses a single threaded model and can service a much larger number of requests than traditional server like Apache HTTP Server


Q.30 We can create child processes in Node applications.

       A. True

       B. False

Ans : True


About Author


After years of Technical Work, I feel like an expert when it comes to Develop wordpress website. Check out How to Create a Wordpress Website in 5 Mins, and Earn Money Online Follow me on Facebook for all the latest updates.

Leave a Comment