- 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 Mock Test
This section presents you various set of Mock Tests related to Node.js Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Node.js Mock Test IV
Q 1 - Which of the following module is required for DNS specific operations?
Answer : A
Explanation
Node.js dns module is used to do actual DNS lookup as well as to use underlying operating system name resolution functionalities.
Q 2 - Which of the following stands true for dns.lookup(hostname[, options], callback) method?
A - Resolves a hostname (e.g. 'google.com') into the first found A (IPv4) or AAAA (IPv6) record.
Answer : C
Explanation
dns.lookup(hostname[, options], callback) resolves a hostname (e.g. 'google.com') into the first found A (IPv4) or AAAA (IPv6) record. options can be an object or integer. If options is not provided, then IP v4 and v6 addresses are both valid. If options is an integer, then it must be 4 or 6.
Q 3 - Which of the following method resolves an ip address to an array of hostnames?
B - dns.resolve(hostname[, rrtype], callback)
Answer : A
Explanation
dns.reverse(ip, callback) resolves an ip address to an array of hostnames.
Q 4 - 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.
Q 5 - 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 6 - Which of the following is true about external 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 : B
Explanation
Error emmitter is added explicitly to a domain using its add method in case of external binding.
Q 7 - 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.
Q 8 - Which of the following code can create a web server?
A - http.createServer(callback)
B - http.createWebServer(callback)
Answer : A
Explanation
http.createServer(callback) method can be used to create a web server.
Q 9 - Which of the following code can make a request to a web server?
A - http.request(options, callback)
B - http.createRequest(options, callback)
Answer : A
Explanation
http.request(options, callback) method can be used to make a request a web server.
Q 10 - What is Express?
Answer : B
Explanation
Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications.
Answer : A
Explanation
Node facilitates creation of child processes to leverage parallel processing on multi-core cpu based systems.
Q 12 - 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.
Q 13 - Which of the following is true about exec methd of child_process module.
A - The exec() method runs a command in a shell and buffers the output.
Answer : D
Explanation
child_process.exec method runs a command in a shell and buffers the output. It returns a buffer with a max size and waits for the process to end and tries to return all the buffered data at once.
Q 14 - Which of the following is true about fork methd of child_process module.
A - The fork() method method is a special case of the spawn() to create Node processes.
Answer : C
Explanation
The fork() method method is a special case of the spawn() to create Node processes. It returns object with a built-in communication channel in addition to having all the methods in a normal ChildProcess instance.
Q 15 - What REST stands for?
A - REpresentational State Transfer
B - Resource Efficient State Transfer
Answer : A
Explanation
REST stands for REpresentational State Transfer.
Q 16 - Which of the following is true about RESTful webservices?
A - Webservices based on REST Architecture are known as RESTful web services.
B - Webservices uses HTTP methods to implement the concept of REST architecture.
Answer : C
Explanation
Webservices based on REST Architecture are known as RESTful web services. These webservices uses HTTP methods to implement the concept of REST architecture.
Answer : D
Explanation
header is not a valid HTTP method.
Answer : A
Explanation
Transform stream is a duplex stream where the output is computed based on input.
Answer : A
Explanation
Each type of Stream is an EventEmitter instance and throws several events at different instance of times.
Answer : A
Explanation
Duplex stream can be used for both read and write operation.
Answer : B
Explanation
A stream fires data event when there is data available to read.
Answer : A
Explanation
A stream fires end event when there is no more data to read.
Q 23 - A stream fires error event when there is any error receiving or writing data.
Answer : B
Explanation
A stream fires error event when there is any error receiving or writing data.
Q 24 - A stream fires finish event when all data has been flushed to underlying system.
Answer : A
Explanation
A stream fires finish event when all data has been flushed to underlying system.
Q 25 - Child processes always have three streams child.stdin, child.stdout, and child.stderr which may be shared with the stdio streams of the parent process.
Answer : A
Explanation
Child processes always have three streams child.stdin, child.stdout, and child.stderr which may be shared with the stdio streams of the parent process.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | C |
3 | A |
4 | C |
5 | A |
6 | B |
7 | C |
8 | A |
9 | A |
10 | B |
11 | A |
12 | B |
13 | D |
14 | C |
15 | A |
16 | C |
17 | D |
18 | A |
19 | A |
20 | A |
21 | B |
22 | A |
23 | B |
24 | A |
25 | A |