• Node.js Video Tutorials

Node.js Online Quiz



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 : B

Explanation

You can use undercore _ to get the last result.

Answer : C

Explanation

Readable stream is used for read operation and its output can be input to a writable stream.

Answer : B

Explanation

fs.writeFile(path, flags[, mode], callback) is the method which is used to write a file.

Answer : A

Explanation

The clearTimeout( t ) global function is used to stop a timer that was previously created with setTimeout(). Here t is the timer returned by setTimeout() function.

Q 6 - Which of the following module is required for operating system specific operations?

A - os module

B - fs module

C - net module

D - None of the above.

Answer : A

Explanation

Node.js os module provides a few basic operating-system related utility functions.

Answer : B

Explanation

os.platform() returns the operating system platform.

Q 8 - net.isIP(input) returns 4 for IP version 4 addresses.

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 : D

Explanation

child_process.exec method runs a command in a shell and buffers the output. It returns a buffer with a max size and waits for the process to end and tries to return all the buffered data at once.

Q 10 - A stream fires finish event when all data has been flushed to underlying system.

A - true

B - false

Answer : A

Explanation

A stream fires finish event when all data has been flushed to underlying system.

nodejs_questions_answers.htm
Advertisements