Node.js Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Node.js Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - Which of the following statement is valid to use a Node module http in a Node based application?

A - var http = require("http");

B - var http = import("http");

C - package http;

D - import http;

Answer : A

Explanation

Require directive is used to load a Node module(http) and store returned its instance(http) into its variable(http).

Answer : A

Explanation

npm stands for Node Package Manager.

Q 3 - Which of the following code gets length of a buffer buf?

A - buf.length

B - buf.size

C - buf.length()

D - buf.size()

Answer : A

Explanation

buf.length returns size of a node buffer in bytes.

Answer : D

Explanation

fs.read(fd, buffer, offset, length, position, callback) is the method which is used to read a file.

Answer : C

Explanation

fs.ftruncate(fd, len, callback) is the method which is used to truncate a file.

Q 6 - Is process a global object?

A - true

B - false

Answer : A

Explanation

The process object is a global object and can be accessed from anywhere.

Answer : A

Explanation

os.totalmem() returns the total amount of system memory in bytes.

Q 8 - net.isIP(input) returns 0 for invalid input.

A - true

B - false

Answer : A

Explanation

net.isIP(input) tests if input is an IP address. Returns 0 for invalid strings, returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses.

Answer : B

Explanation

Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications.

Q 10 - Each type of Stream is an EventEmitter.

A - true

B - false

Answer : A

Explanation

Each type of Stream is an EventEmitter instance and throws several events at different instance of times.

nodejs_questions_answers.htm
Advertisements