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

Answer : C

Explanation

Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution.

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

A - $ npm --version

B - $ node --version

C - $ npm getVersion

D - $ node getVersion

Answer : A

Explanation

Executing $ npm --version command will show the version of npm instance.

Q 3 - Which of the following code converts a buffer buf to JSON object?

A - buf.toJSON()

B - buf.json()

C - buf.covertToJson()

D - buf.jsonify()

Answer : A

Explanation

buf.toJSON() converts a buffer buf to JSON object.

Answer : D

Explanation

Piping is a mechanism where we provide output of one stream as the input to another stream. It is normally used to get data from one stream and to pass output of that stream to another stream. There is no limit on piping operations.

Answer : B

Explanation

fs.rmdir(path, callback) is the method which is used to remove a directory.

Answer : B

Explanation

os.type() returns the operating system name.

Q 7 - Which of the following is the correct way to get an absolute path?

A - os.resolve('main.js')

B - path.resolve('main.js')

C - fs.resolve('main.js')

D - None of the above.

Answer : B

Explanation

path.resolve([from ...], to) resolves to an absolute path.

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

Explanation

http.createServer(callback) method can be used to create a web server.

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

A - true

B - false

Answer : A

Explanation

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

nodejs_questions_answers.htm
Advertisements