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.js is a JavaScript based framework/platform built on Google Chrome's JavaScript V8 Engine.

Q 2 - By default, npm installs any dependency in the global mode.

A - true

B - false

Answer : B

Explanation

By default, npm installs any dependency in the local mode.

Answer : D

Explanation

Node js is a single threaded application but it support concurrency via concept of event and callbacks. As every API of Node js are asynchronous and being a single thread, it uses async function calls to maintain the concurrency. Node uses observer pattern. Node thread keeps an event loop and whenever any task get completed, it fires the corresponding event which signals the event listener function to get executed.

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

process.version can be used to get the current process version.

Q 7 - Which of the following is the correct way to get an extension of a file?

A - fs.extname('main.js')

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

C - os.extname('main.js')

D - None of the above.

Answer : B

Explanation

path.extname(p) returns the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.

Q 8 - Which of the following module is required for exception handling in Node?

A - web module

B - net module

C - domain module

D - error module

Answer : C

Explanation

Node.js domain module is used to intercept unhandled error. These unhandled error can be intercepted using internal binding or external binding. If errors are not handled at all then they will simply crash the Node application.

Answer : A

Explanation

http.request(options, callback) method can be used to make a request a web server.

Q 10 - Duplex stream can be used for both read and write operation.

A - true

B - false

Answer : A

Explanation

Duplex stream can be used for both read and write operation.

nodejs_questions_answers.htm
Advertisements