Node.js MCQs

Node.js MCQs

Answer these 300+ Node.js MCQs and assess your grip on the subject of Node.js.
Scroll below and get started!

1: What program is used to programmtically control the browser?

A.   vbscript

B.   C#

C.   javascript

D.   perl

2: net.Server emits an event every time a ____ connects to the server.

A.   object

B.   peer

C.   packet

D.   cat cable

3: If you have a problem with your code, where would you look?

A.   os.log

B.   app.log

C.   console.log

D.   system.log

4: If you have a node program called example.js, how would that be excuted?

A.   launch example.js

B.   start example.js

C.   node example.js

D.   exec example.js

5: REPL is:

A.   Read-Eval-Print-Loop, a way to interactively run code

B.   Replicates an existing Buffer, optionally resetting the size

C.   A string replacement method

D.   REnder PLaceholders - a templating function

6: To declare a variable use what keyword?

A.   integer

B.   float

C.   var

D.   string

7: The "js" in Node.js stands for?

A.   doesn't stand for anything

B.   Junior Seau

C.   The creator of the language Jack Snyder

D.   javascript

8: Which is a comment in node?

A.   //comment

B.   Comment

C.   ?Comment

D.   >>Comment

9: How do you require a module?

A.   #import mymodule

B.   <script src='mymodule' />

C.   #include mymodule

D.   var module = require('mymodule')

10: NPM is a...

A.   Module

B.   Package manager

C.   Web Server

D.   Sweet Acronym

11: How do you output to console in node.js?

A.   util.log or console.log

B.   trace or log

C.   sys.puts or util.puts

12: A module is an____?

A.   Object

B.   integer

C.   variable

D.   an event

13: What is node.js based on?

A.   Unix's Websocket layer

B.   Cocoa's Unix backend

C.   Chrome's JavaScript runtime

14: What is a Buffer?

A.   Similar to setTimeout in the browser

B.   Raw memory allocated outside the v8 heap

C.   A String

15: WebSockets with Socket.io can be used to?

A.   Send messages from one client to another.

B.   All of these.

C.   Send messages from the client to the server.

D.   Send messages from the server to the client.

16: Which of the following can be created and managed using node.js?

A.   All of these

B.   Chatrooms

C.   Webservers

D.   Spambots

E.   Data Compilers

17: Node.js is stored on your____?

A.   hard drive

B.   power supply

C.   serial bus

D.   motherboard

18: True or False: node.js can call other command line scripts.

A.   False

B.   True

19: In node.js you can write and run code in what language?

A.   Javascript and Java

B.   Java

C.   Javascript

D.   C++

E.   any language if you have the compiler for those installed on your machine

20: Why is Node.js important?

A.   Chrome comes bundled with Node.js and everyong needs Chrome

B.   Javascript is powerless without the aid of Node.js

C.   It allows asynchronous processing in the background without interupting the user

D.   Browsers are weak, adding Node.js to your browser beefs it up

A.   spring

B.   maven

C.   express

D.   tab

22: How does one get access to Node.js?

A.   a part of the OS

B.   a part of the registry

C.   download the install

D.   a part of the browser

23: Which of the following command-line arguments to "npm install" will allow a module to be installed outside the project folder?

A.   --global

B.   --save

C.   --link

24: What Javascript Engine does node.js use?

A.   Chakra

B.   V8

C.   Rhino

D.   SpiderMonkey

E.   JägerMonkey

25: What does "npm" stand for?

A.   Node Packaged Modules

B.   Node Package Manager

C.   None of these

D.   Node Process Manager

26: What does Node.js run on?

A.   database

B.   client

C.   SAN

D.   server

27: How do you call a function attached to an object that will be executed when the object emits an event?

A.   Listener

B.   Process

C.   Link

D.   Log

E.   Buffer

28: What kind of application is better suited to node.js?

A.   General Purpose Applications

B.   I/O Bound Applications

C.   CPU Bound Applications

29: Use _____ to step through your code.

A.   manual

B.   URL string

C.   ruler

D.   breakpoints

30: What is the code to access the DNS module?

A.   require('dns');

B.   request(dns);

C.   npm_module('dns');

D.   req('dns');

31:

In this code:

function myLog(err, data) {

console.log(err, data);

} fs.readFile('/tmp/sample', myLog);

The function 'myLog' is used as a(an):

A.   Object method

B.   Prototype

C.   Filter

D.   Callback

32: What interface is used to access folders on your local drive

A.   file

B.   fs

C.   fso

D.   drive

33: What function is used to write out application errors/events?

A.   process.write

B.   system.inform

C.   util.log

D.   console.log

34: Which is of the following is a potential advantage of using Node.js?

A.   Node.js is non-blocking and scalable.

B.   Node.js allows you use the same language on the server and client.

C.   Node.js is powered by a high-performance V8 engine.

D.   All of these.

35: Which npm command will load all dependencies in the local node_modules folder?

A.   npm start

B.   npm load

C.   npm install

D.   npm run

36: node.js excels at dealing with:

A.   JRE optimization

B.   fibonacci benchmarks

C.   I/O-bound tasks

37:

Running the following code, what will the console output?

var http = require('http');

http.createServer( function (request, response) { response.writeHead(200,

{'Content-Type': 'text/plain'});

response.end('Hello World\n'); } ).listen(8000);

console.log('Server running at http://localhost:8000/');

A.   Hello World

B.   undefined

C.   Hello World\n

D.   Server running at http://localhost:8000/

38: What does the require call return?

A.   none of the above

B.   module.exports object

C.   string object

39: In the following Express route stack, which handler will be called for "GET /item/23"? app.get("/", routes.index ); app.get("/item", routes.item ); app.get("/item/:id", routes.id ); app.post("/item/:id", routes.post );

A.   routes.post

B.   routes.id

C.   routes.item

D.   routes.index

40: How do you cause a function to be invoked at a specified time later?

A.   wait(1000)

B.   setTimeout(fn, 1000)

C.   process.wait(1000)

D.   process.wait(fn, 1000)

E.   process.delay(1000, fn)

41: Where does Node run on your machine?

A.   in the registry

B.   as an application

C.   in your browser

D.   in your TIF file

42: What is REPL?

A.   Read-Eval-Print-Loop

B.   Repeat Languages

C.   Read-Edit-Place-Leverage

43: What method is used to parse JSON using NodeJS?

A.   JSON.parseJSON()

B.   JSON.toJSON()

C.   None of the above

D.   JSON.parse();

44: What interface is used to create a server through Node.js

A.   server

B.   url

C.   http

D.   web

45: What is node.js?

A.   A program written in C

B.   Hardware

C.   A program written in Lisp

D.   jQuery module

E.   An Apache Module

46: How can I call an object function from my module if my module name is "iModule"?

A.   require('iModule').mObject();

B.   request('iModule').mObject();

C.   require('iModule').prototype.mObject();

D.   import('iModule').mObject();

47: True or False: node.js runs in a single thread.

A.   False

B.   True

48: What does the Zlib module provide?

A.   It also offers a set of wrappers for OpenSSL's hash, hmac, cipher, decipher, sign and verify methods.

B.   Realtime application framework for Node.JS, with HTML5 WebSockets and cross-browser fallbacks support.

C.   Bindings to application logging classes

D.   Bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes

49: Which of these is a built-in module that can be used for unit testing in Node.js?

A.   Test

B.   Error

C.   Assert

D.   Fail

50: Timer functions are built into node.js, you do not need to require() this module in order to use them.

A.   true

B.   false