- 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 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 - What is use of Underscore Variable in REPL session?
Answer : B
Explanation
You can use undercore _ to get the last result.
Q 3 - Buffer class is a global class and can be accessed in application without importing buffer module.
Answer : A
Explanation
Buffer class is a global class and can be accessed in application without importing buffer module.
Q 4 - Which method of fs module is used to write a file?
A - fs.write(path, flags[, mode], callback)
B - fs.writeFile(path, flags[, mode], callback)
Answer : B
Explanation
fs.writeFile(path, flags[, mode], callback) is the method which is used to write a file.
Q 5 - Which of the following is true about setTimeout(cb, ms) global function?
Answer : C
Explanation
The setTimeout(cb, ms) global function is used to run callback cb after at least ms milliseconds. The actual delay depends on external factors like OS timer granularity and system load. A timer cannot span more than 24.8 days. This function returns an opaque value that represents the timer which can be used to clear the timer.
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 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 API creates a client?
A - net.createServer([options][, connectionListener])
B - net.connect(options[, connectionListener])
Answer : A
Explanation
net.connect(options[, connectionListener]) is a factory method, which returns a new 'net.Socket' and connects to the supplied address and port and can be used to create a client.
Q 9 - Which of the following module is required to create a web server?
Answer : C
Explanation
Node.js provides http module which can be used to create HTTP client of server.
Answer : B
Explanation
A stream fires data event when there is data available to read.