NodeJs MCQ Questions
11. Node.js uses _____________ programming.
A. asynchronous
B. synchronous
C. Both A and B
D. None of the above
View Answer
Ans : A
Explanation: Node.js uses asynchronous programming.
12. Node.js files have extension?
A. .njs
B. .node
C. .js
D. .nj
View Answer
Ans : C
Explanation: Node.js files have extension .js
13. Node.js runs?
A. single-threaded
B. non-blocking
C. asynchronously programming
D. All of the above
View Answer
Ans : D
Explanation: Node.js runs single-threaded, non-blocking, asynchronously programming, which is very memory efficient.
14. To include a module, use the ___________ function with the name of the module.
A. function()
B. require()
C. exports()
D. module()
View Answer
Ans : B
Explanation: To include a module, use the require() function with the name of the module : var http = require('http');
15. Node.js has a built-in module called?
A. https
B. http
C. server
D. module
View Answer
Ans : B
Explanation: Node.js has a built-in module called HTTP, which allows Node.js to transfer data over the Hyper Text Transfer Protocol (HTTP).
16. Which method to create an HTTP server?
A. createServer()
B. getServer()
C. putServer()
D. setServer()
View Answer
Ans : A
Explanation: Use the createServer() method to create an HTTP server
17. The Node.js modules can be exposed using
A. module.expose
B. module
C. module.exports
D. All of the above
View Answer
Ans : C
Explanation: The Node.js modules can be exposed using module.exports.
18. Which of the following is true about process global object?
A. The process object is an instance of EventEmitter.
B. process emits exit event when process is about to exit.
C. process emits uncaughtException when when an exception bubbles all the way back to the event loop.
D. All of the above
View Answer
Ans : D
Explanation: The process object is an instance of EventEmitter and emits the above mentioned events.
19. A package in Node.js contains all the files you need for a module.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, A package in Node.js contains all the files you need for a module.
20. The fs.read() method is used to read files on your computer.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : B
Explanation: The fs.readFile() method is used to read files on your computer.
Discussion