Node.js MCQ1) Which of the following statement is correct?
Answer: A is the correct option. Node.js is Server Side Language. 2) What does the REPL stand for?
Answer: A is the correct option. REPL stands for "Read Eval Print Loop". 3) Which of the following command is used to start a REPL session?
Answer: A is the correct option. We can start REPL simply by running node on shell/console without any argument. 4) In which language is Node.js written?
Answer: E is the correct option. Node.js is a cross-platform, back-end JavaScript runtime environment written in JavaScript, C, C++, and CoffeeScript language. 5) Which of the following command is used to install the Node.js express module?
Answer: A is the correct option. The $ npm install express command is used to install the Node.js express module. 6) What is Callback?
Answer: B is the correct option. The callback is an asynchronous equivalent for a function. 7) Which of the following extension is used to save the Node.js files?
Answer: A is the correct option. The ".js" extension is used to save the Node.js files. 8) The Node.js modules can be exposed using:
Answer: C is the correct option. The Node.js modules can be exposed using module.exports. 9) Which of the following module is not a built-in node module?
Answer: D is the correct option. The "fsread" is not a built-in node module. 10) Which of the following method of fs module is used to get file information?
Answer: B is the correct option. The fs.stat(path, callback) method is used to get information about a file. 11) What does the fs module stand for?
Answer: B is the correct option. The fs module stands for File System. 12) Which of the following method of fs module is used to truncate a file?
Answer: C is the correct option. The fs.ftruncate(fd, len, callback) method is used to truncate a file. 13) Which of the following template engines can be used with Node.js?
Answer: C is the correct option. Handlebars are the template engines that can be used with Node.js. 14) Which of the following code print the platform of operating system?
Answer: B is the correct option. The os.platform() returns the operating system platform. 15) Which of the following method is used to return the current working directory of the process?
Answer: A is the correct option. The process.cwd() method is used to return the current working directory of the process. 16) Which of the following statement defines Express?
Answer: B is the correct option. Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develop web and mobile applications. 17) Which of the following is not a benefit of using modules in Express?
Answer: C is the correct option. "It provides a means of reducing the size of the program" is not a benefit of modules in Express. 18) What is the best practice to do in your code to improve the performance of your application?
Answer: A is the correct option. Using gzip compression is the best practice to do in your code to improve the performance of your application. 19) What is the default scope in the Node.js application?
Answer: B is the correct option. Local is the default scope in the Node.js application. 20) Which of the following engine Node in core?
Answer: A is the correct option. Node uses the Chrome V8 engine in the core. 21) Which of the following statement is used to execute the code of the sample.js file?
Answer: B is the correct option. The "node sample.js" statement is used to execute the code of the sample.js file. 22) Which of the following is not a valid language for Node.js?
Answer: B is the correct option. Java is not a valid language for Node.js. 23) Which of the following shortcut command is used to kill a process in Node.js?
Answer: D is the correct option. The Ctrl + C command is used to kill a process in Node.js. 24) How many Node object methods are available?
Answer: B is the correct option. There are 18 object methods available in Node. 25) What is the main usage of Node.js terminal (REPL)?
Answer: B is the correct option. The Node.js terminal (REPL) is used for testing Node.js/JavaScript expressions. 26) Which of the following types of applications can be built using Node.js?
Answer: D is the correct option. All of the above types of applications can be built by using Node.js. 27) Which of the following is used to test if two nodes are equal?
Answer: C is the correct option. The "isEqualNode()" is used to test if two nodes are equal. 28) Which of the following tool is used to automate the various tasks of the Node.js application?
Answer: B is the correct option. GruntJS tool is used to automate the various tasks of the Node.js application. 29) Which of the following areas, Node.js, is not advised to be used?
Answer: C is the correct option. It is not advisable to use Node.js for CPU-intensive applications. 30) Which of the following route parameter formats are valid?
Answer: A is the correct option. 31) Which of the following module is required to create a web server?
Answer: D is the correct option. The url module is required to create a web server. 32) Which of the following is the correct syntax to initiate the Node.js File?
Answer: C is the correct option. The correct syntax to initiate the Node.js File is node filename.js. 33) Which of the following method is used to compare the placement of two nodes in the DOM hierarchy (document)?
Answer: B is the correct option. The compareDocumentPosition()method compares the placement of two nodes in the DOM hierarchy (document). 34) Which of the following platforms does Node.js support?
Answer: D is the correct option. Node.js is supported on all of the above written operating systems. 35) Which of the following keyword is used to make properties and methods available outside the module file?
Answer: C is the correct option. The exports keyword is used to make properties and methods available outside the module file. 36) Which of the following Node.js object property is used to return the node immediately before a node?
Answer: C is the correct option. The previousSibling object property is used to return the node immediately before a node. 37) Which of the following method can append specified content to a file?
Answer: A is the correct option. The fs.appendFile() method is used to append the specified content to a file. If the file does not exist, it creates the file. 38) Which of the following is a GUI-based debugging tool for Node.js?
Answer: D is the correct option. Node Inspector is a GUI-based debugging tool for Node.js. 39) What is the use of underscore variable in REPL session in Node.js?
Answer: C is the correct option. In Node.js, the underscore variable in REPL session is used to get the last result. True or False Questions40) The buffer class is a global class that can be accessed without importing a buffer module.
Answer: True. A is the correct option. A buffer class is a global class that can be accessed in the application without importing a buffer module. 41) Is Node.js multithreaded?
Answer: No. B is the correct option. Node.js is not multithreaded. 42) Is the process a global object and can be accessed from anywhere?
Answer: True. A is the correct option. The process object is a global object and can be accessed from anywhere. 43) Node.js uses an event-driven, non-blocking I/O model. Is it true?
Answer: True. A is the correct option. Node.js uses an event-driven, non-blocking I/O model. 44) The net.isIP(input) returns 0 for invalid input. Is it true?
Answer: True. A is the correct option. The net.isIP(input) tests if input is an IP address. It returns 0 for invalid strings, returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. 45) A stream fires finish event when all data has been flushed to the underlying system. Is it true?
Answer: True. A is the correct option. 46) A stream fires data event when there is data available to read. Is it true?
Answer: True. A is the correct option. A stream fires data event when there is data available to read. Next Topic# |