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

Answer : B

Explanation

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

Q 2 - Which of the following command will show all the modules installed globally?

A - $ npm ls -g

B - $ npm ls

C - $ node ls -g

D - $ node ls

Answer : A

Explanation

Executing $ npm ls -g command will show all the modules installed globally.

Answer : C

Explanation

emit property is used to fire an event.

Answer : C

Explanation

Chanining is a mechanism to connect output of one stream to another stream and create a chain of multiple stream operations. It is normally used with piping operations.

Answer : B

Explanation

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

Answer : D

Explanation

Node.js console is a global object and is used to print different levels of messages to stdout and stderr. There are built-in methods to be used for printing informational, warning and error messages. It is used in synchronous way when destination is file or a terminal and asynchronous way when destination is a pipe.

Answer : A

Explanation

path.normalize(p) normalizes a string path, taking care of '..' and '.' parts.

Q 8 - net.isIP(input) tests if input is an IP address or not.

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

Explanation

The fork() method method is a special case of the spawn() to create Node processes. It returns object with a built-in communication channel in addition to having all the methods in a normal ChildProcess instance.

Q 10 - Which of the following is not a valid HTTP method?

A - get

B - put

C - post

D - header

Answer : D

Explanation

header is not a valid HTTP method.


nodejs_questions_answers.htm

Advertisements