21. Which is a fast C++ based JavaScript interpreter? A. Node B. Sockets C. Processors D. Closures Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: Node is a fast C++-based JavaScript interpreter with bindings to the low-level Unix APIs for working with processes, files, network sockets, etc., and also to HTTP client and server APIs.
22. Why does the Node rely on event handlers? A. APIs are synchronous B. APIs are asynchronous C. APIs are reusable D. None of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: Because the APIs are asynchronous, Node relies on event handlers, which are often implemented using nested functions and closures.
23. What is the command to run the node programs? A. node(program.js) B. program.js C. node program.js D. node.program.js Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: The node programs can be run with the command: node program.js
24. What is the alternative command used in Node for load()? A. store() B. module() C. log() D. require() Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D Solution: Use require() instead of load(). It loads and executes (only once) the named module, returning an object that contains its exported symbols.
25. What is the command used for debugging output in Node? A. print(); B. console.log(…); C. debug(…); D. execute(…); Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: Node defines console.log() for debugging output like browsers do.
26. What is the code to print hello one second from now? A. setTimeout(function() { console.log("Hello World"); }, 1000); B. setTimeout(function() { 1000, console.log("Hello World"); }); C. setTimeout(function(1000) { console.log("Hello World"); }); D. setTimeout(function() { console.log("Hello World"); }); Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: The above code snippet says hello one second from now.
27. Among the below given functions, Node supports which of the following client-side timer functions? A. getInterval() B. Interval() C. clearTime() D. clearTimeout() Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D Solution: Node supports the client-side timer functions set setTimeout(), setInterval(), clearTimeout(), and clearInterval().
28. The necessary globals of a node are defined under which namespace? A. variables B. system C. process D. using Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: Node defines other important globals under the process namespace.
29. Why does Node not block while waiting for operations to complete? A. Static B. Asynchronous C. Synchronous D. None of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: Because Node’s functions and methods are asynchronous, they do not block while waiting for operations to complete.
30. Which is the method used for registering handlers? A. on() B. register() C. add() D. include() Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: Node objects that generate events (known as event emitters) define an on() method for registering handlers.