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 - What is Node.JS?
By default, npm installs any dependency in the local mode.
Q 3 - Which of the following is true with respect to Node.
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.
Q 4 - Which of the following is true about Piping streams?
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.
Q 5 - Which method of fs module is used to remove a directory?
fs.rmdir(path, callback) is the method which is used to remove a directory.
Q 6 - Which of the following code prints process version?
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?
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?
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.
Q 9 - Which of the following code can make a request to a web server?
http.request(options, callback) method can be used to make a request a web server.
Duplex stream can be used for both read and write operation.