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 1Which of following command starts a REPL session?

A - $ node

B - $ node start

C - $ node repl

D - $ node console

Answer : A

Explanation

REPL can be started by simply running node on shell/console without any argument.

Q 2 - Which of the following command will show version of Node?

A - $ npm --version

B - $ node --version

C - $ npm getVersion

D - $ node getVersion

Answer : B

Explanation

Executing $ node --version command will show the version of Node instance.

Answer : C

Explanation

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

Answer : C

Explanation

Every method in fs module have synchronous as well as asynchronous form. Asynchronous methods of fs module take last parameter as completion function callback and first parameter of the callback function as error.

Answer : A

Explanation

The __dirname represents the name of the directory that the currently executing script resides in.

Answer : A

Explanation

process.memoryUsage() can be used to get the memory usage.

Answer : A

Explanation

net.createServer([options][, connectionListener]) creates a new TCP server. The connectionListener argument is automatically set as a listener for the 'connection' event.

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 : 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 error event when there is any error receiving or writing data.

A - false

B - true

Answer : B

Explanation

A stream fires error event when there is any error receiving or writing data.

nodejs_questions_answers.htm
Advertisements