Olete.in
Articles
Mock Tests
🧪 Node JS MCQ Quiz Hub
Nodejs Mcq Question Set 2
Choose a topic to test your knowledge and improve your Node JS skills
1. What are the key features of Node.js?
Real time Data intensive
Highly scalable servers for Web Applications
Builds fast and scalable network Applications
All of the above
2. How can we check the current version of NPM?
. npm --version
npm --ver
npm help
None of the above
3. What is the advantage of using node.js?
It provides an easy way to build scalable network programs
Generally fast
All of these
Great concurrency
4. Why a Node.JS code is pretty fast although being written in JavaScript?
Node.JS internally converts JavaScript code to Java based code and then execute the same
Node.JS internally converts JavaScript code to C based code and then execute the same
Being built on Google Chrome's V8 JavaScript Engine
none of the above
5. What is REPL in Node.js?
Eval
Print
Loop
All of these
6. Which module is used to serve static resources in Node.js?
node-static
http
node-resource
static
7. What should you do in your code to improve your application's performance?
Use gzip compression
Don't use synchronous functions
Do logging correctly
Handle exceptions properly
8. Is console a global object?
null
false
true
none of the above
9. To install Node.js express module
$ npm install express
$ node install express
$ install express
None of above
10. Which of the followings are valid languages for Node.js?
JavaScript
Java
C++
C#
11. Which of the following tool automates various tasks of Node.js application?
Express.js
GruntJS
NPM
none of the above
12. In Node.js APIs of Node.JS are which of the following?
Asynchronous
Synchronous
Both of the above
none of the above
13. Which of the following class is used to create and consume custom events in Node.js?
EventEmitter
Events
NodeEvent
none of the above
14. Node.js supports which of the following platform?
Windows
Macintosh
. Unix/Linux
All of the above
15. Which of following are a valid form of route path?
strings
string patterns
regular expressions
all of above
16. Which of the following statements holds good with respect to Node?
Node being a single thread, and uses async function calls to maintain the concurrency
Every API of Node js are asynchronous
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
All of these
17. In Nodejs what is use of underscore variable in REPL session?
to store the result
to get the last command used
None of the above
to get the last result
18. Which statement is valid in using a Node module fs in a Node based application?
var fs = import("fs")
import fs
package fs
var fs = require("fs")
19. 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.
false
true
All the above
None of these
20. Which of the following is true about Node.js?
Node.js is an open source server environment.
Node.js allows you to run JavaScript on the server.
Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
All of the above
21. Which of the following is false?
Node.js can create, open, read, write, delete, and close files on the server
Node.js can generate static page content
Node.js can collect form data
Node.js can add, delete, modify data in your database
22. Node.js files must be initiated in the?
Command Prompt
nodejs Editor
Both A and B
none of the above
23. Syntax to Initiate the Node.js File is?
filename.js
javascript filename.js
node filename.js
node filename
24. Which keyword is used to make properties and methods available outside the module file?
import
module
exports
require
25. Which method appends specified content to a file.
fs.appendFile()
fs.open()
fs.writeFile()
none of the above
26. Which of the following command will show version of Node?
$ npm --version
$ npm getVersion
$ node getVersion
$ node --version
27. which of the following areas, Node.js is not advised to be used?
Single Page Applications
JSON APIs based Applications
CPU intensive applications
Data Intensive Realtime Applications (DIRT)
28. The URL module splits up a web address into readable parts.
TRUE
FALSE
Can be true or false
Can not say
29. Node.js uses _______ programming.
asynchronous
synchronous
Both A and B
none of the above
30. Node.js files have extension?
.njs
.node
.js
.nj
31. Node.js runs?
single-threaded
non-blocking
asynchronously programming
All of the above
32. To include a module, use the _______ function with the name of the module.
function()
require()
exports()
module()
33. Node.js has a built-in module called?
https
http
server
module
34. Which method to create an HTTP server?
createServer()
getServer()
putServer()
setServer()
35. Which of the following is true about process global object?
The process object is an instance of EventEmitter.
process emits exit event when process is about to exit.
process emits uncaughtException when when an exception bubbles all the way back to the event loop.
All of the above
36. A package in Node.js contains all the files you need for a module.
TRUE
FALSE
Can be true or false
Can not say
37. The fs.read() method is used to read files on your computer.
TRUE
FALSE
Can be true or false
Can not say
38. Which statement execute the code of sample.js file?
nodejs sample.js
node sample.js
sample.js
none of the above
39. How can we create instance of http module ?
var http = require("http");
var http = new require("http");
var http = new http();
none of the above
40. The $ npm ls -g statement is used to list down all the locally installed module?
True
False
all of the above
none of the above
41. How can we check the cujrrent version of NPM?
npm --version
npm --ver
npm help
none of the above
42. The $ npm ls statement is used to list down all the locally installed module?
True
False
all of the above
none of the above
43. package.json is is used to define the properties of a package?
True
False
all of the above
none of the above
44. What would be the output of the below code ? var http = require("http"); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Welcome to the nodejs '); }).listen(8083); console.log('Server running at http://127.0.0.1:8083/');
Welcome to the nodejs
Error
Server running at http://127.0.0.1:8083/
none of the above
45. What would be the output of the below code ? $ node > var y = 10
10
Error
undefined
none of the above
46. Find output of the following program ? $ node > 15 + ( 2 * 4 ) - 8
15
Error
undefined
none of the above
47. Guess the output of the following program ? $ node > var k=10 undefined > y=10 10 > k+y
Error
20
undefined
none of the above
48. What would be the output of the below code ? $ node > y = 10
10
Error
undefined
none of the above
Submit