- Node.js Tutorial
- Node.js - Home
- Node.js - Introduction
- Node.js - Environment Setup
- Node.js - First Application
- Node.js - REPL Terminal
- Node.js - Command Line Options
- Node.js - Package Manager (NPM)
- Node.js - Callbacks Concept
- Node.js - Upload Files
- Node.js - Send an Email
- Node.js - Events
- Node.js - Event Loop
- Node.js - Event Emitter
- Node.js - Debugger
- Node.js - Global Objects
- Node.js - Console
- Node.js - Process
- Node.js - Scaling Application
- Node.js - Packaging
- Node.js - Express Framework
- Node.js - RESTFul API
- Node.js - Buffers
- Node.js - Streams
- Node.js - File System
- Node.js MySQL
- Node.js - MySQL Get Started
- Node.js - MySQL Create Database
- Node.js - MySQL Create Table
- Node.js - MySQL Insert Into
- Node.js - MySQL Select From
- Node.js - MySQL Where
- Node.js - MySQL Order By
- Node.js - MySQL Delete
- Node.js - MySQL Update
- Node.js - MySQL Join
- Node.js MongoDB
- Node.js - MongoDB Get Started
- Node.js - MongoDB Create Database
- Node.js - MongoDB Create Collection
- Node.js - MongoDB Insert
- Node.js - MongoDB Find
- Node.js - MongoDB Query
- Node.js - MongoDB Sort
- Node.js - MongoDB Delete
- Node.js - MongoDB Update
- Node.js - MongoDB Limit
- Node.js - MongoDB Join
- Node.js Modules
- Node.js - Modules
- Node.js - Built-in Modules
- Node.js - Utility Modules
- Node.js - Web Module
- Node.js Useful Resources
- Node.js - Quick Guide
- Node.js - Useful Resources
- Node.js - Dicussion
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 - Which of the following statement is valid to use a Node module http in a Node based application?
A - var http = require("http");
Answer : A
Explanation
Require directive is used to load a Node module(http) and store returned its instance(http) into its variable(http).
Q 2 - Which of the following command will show all the modules installed locally.
Answer : B
Explanation
Executing $ npm ls command will show all the modules installed locally.
Q 3 - Which of the following is true with respect to Node.
A - Every API of Node js are asynchronous.
B - Node being a single thread, and uses async function calls to maintain the concurrency.
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.
Q 4 - Which method of fs module is used to close a file?
B - fs.closeFile(fd, callback)
Answer : A
Explanation
fs.close(fd, callback) is the method which is used to close a file.
Q 5 - Which method of fs module is used to read a directory?
A - fs.readDirectory(path[, mode], callback)
B - fs.read(path[, mode], callback)
Answer : C
Explanation
fs.readdir(path, callback)is the method which is used to read a directory.
Q 6 - Which of the following is true about process global object?
A - The process object is an instance of EventEmitter.
Answer : D
Explanation
The process object is an instance of EventEmitter and emits the above mentioned events.
Q 7 - Which of the following is the correct way to get a joint path?
A - path.join('/test', 'test1', '2slashes/1slash', 'tab', '..')
B - path.combine('/test', 'test1', '2slashes/1slash', 'tab', '..')
C - buffer.join('/test', 'test1', '2slashes/1slash', 'tab', '..')
Answer : A
Explanation
path.join([path1][, path2][, ...]) joins all arguments together and normalize the resulting path.
Q 8 - Which of the following module is required for exception handling in Node?
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
Node facilitates creation of child processes to leverage parallel processing on multi-core cpu based systems.
Answer : B
Explanation
A stream fires data event when there is data available to read.