- 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 - Why code written in Node.JS is pretty fast although being written in JavaScript?
A - Node.JS internally converts JavaScript code to Java based code and then execute the same.
B - Node.JS internally converts JavaScript code to C based code and then execute the same.
Answer : C
Explanation
Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution.
Q 2 - Which of the following is true about package.json?
A - package.json is present in the root directory of any Node application/module.
B - package.json is used to define the properties of a package.
C - package.json can be used to update dependencies of a Node application.
Answer : D
Explanation
package.json is present in the root directory of any Node application/module and is used to define the properties of a package. It can also be used to update dependencies of a Node application.
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 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 of the following is true about clearTimeout(t) global function?
Answer : A
Explanation
The clearTimeout( t ) global function is used to stop a timer that was previously created with setTimeout(). Here t is the timer returned by setTimeout() function.
Q 6 - Which of the following code prints memory usage?
A - console.log(process.memoryUsage());
B - console.log('Current version: ' + process.memory());
Answer : A
Explanation
process.memoryUsage() can be used to get the memory usage.
Q 7 - Which of the following code print the total free memory of operating system?
A - console.log('free memory : ' + os.freemem() + " bytes.");
B - console.log('free memory : ' + os.freemem + " bytes.");
C - console.log('free memory : ' + os.getFreeMemory() + " bytes.");
Answer : A
Explanation
os.freemem() returns the free amount of system memory in bytes.
Q 8 - Which of the following is true about internal binding with respect to domain module?
A - Error emmitter is executing its code within run method of a domain.
B - Error emmitter is added explicitly to a domain using its add method.
Answer : A
Explanation
Error emmitter is executing its code within run method of a domain in case of internal binding.
Q 9 - Which of the following module is required to create a child process?
Answer : B
Explanation
Node provides child_process module which provides ways to create child process.
Answer : D
Explanation
header is not a valid HTTP method.