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.
Q 1 - How Node based web servers are different from traditional web servers?
A - Node based server process request much faster than traditional server.
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?
Answer : A
Explanation
Executing $ npm ls -g command will show all the modules installed globally.
Q 3 - Which of the following is true about EventEmitter.emit property?
A - emit property is used to locate an event handler.
B - emit property is used to bind a function with the event.
Answer : C
Explanation
emit property is used to fire an event.
Q 4 - Which of the following is true about Chaining streams?
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.
Q 5 - Which method of fs module is used to remove a directory?
A - fs.deleteDirectory(path[, mode], callback)
Answer : B
Explanation
fs.rmdir(path, callback) is the method which is used to remove a directory.
Q 6 - Which of the following is true about console global object?
B - console is used in synchronous way when destination is file or a terminal.
C - console is used in asynchronous way when destination is a pipe.
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.
Q 7 - Which of the following is the correct way to get a normalized path?
A - path.normalize('/test/test1//2slashes/1slash/tab/..')
B - fs.normalize('/test/test1//2slashes/1slash/tab/..')
Answer : A
Explanation
path.normalize(p) normalizes a string path, taking care of '..' and '.' parts.
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.
Q 9 - Which of the following is true about fork methd of child_process module.
A - The fork() method method is a special case of the spawn() to create Node processes.
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.
Answer : D
Explanation
header is not a valid HTTP method.