Fullstack Javascript Test
Backend Node

The Backend (with Node.js)

Question #41

Why is "Node.js" named Node?

A) To emphasize the idea that a Node.js application should comprise multiple small distributed nodes that communicate with each other

B) A Node.js application automatically creates many forks to replace the concept of threads. These forks are known as "nodes"

C) Node.js ships with many built-in modules that are also known as "nodes"

D) Node.js is designed to work with the Operating Systems inodes.

Question #42

When you run JavaScript in a Node.js application, which of the following "elements" in a Node.js stack actually executes that JavaScript?

A) The libuv library

B) The VM (like V8 or Chakra)

C) The c-ares library

D) The repl module

Question #43

You have a locked JavaScript file that uses the timers API functions (like setTimeout and setInterval). You need to measure how much a function delayed or repeated by these timers take to finish executing. How can you do that in Node.js given that you can’t modify (or copy) the content of that JavaScript file?

A) You can’t.

B) You can measure the time the whole script takes and then use the delays of the timers to estimate how much time each one took

C) You can use NODE_DEBUG=timers to accomplish that

D) You can use the -r CLI option to load a script that overrides the definitions of the timers API functions.

Question #44

Which of the followings is an external library that Node.js uses? ("external" means it has its own code-base and license and is not managed by the Node.js core team)

A) crpyto

B) cluster

C) openssl

D) events

Question #45

Which of the following Node.js modules should you use when you need to decode raw data into strings?

A) string_decoder

B) string_buffer

C) buffer

D) util

Question #46

What is a non-blocking method in Node?

A) A method that does not place any read-locks on files in the file system

B) A method that executes asynchronously

C) A method that executes synchronously

D) A method that does not block the execution of previous lines of code

Question #47

Is Node.js single-threaded?

A) Every Node process runs in a single thread and all the I/O work is run in that same thread

B) JavaScript execution in Node.js is single-threaded but I/O operations are executed using multiple threads

C) Every Node process gets 4 threads that it can share between its JavaScript VM and the event loop

D) The event loop is single-threaded but a JavaScript VM can use multiple threads

Question #48

Which library provides Node.js with the "Event Loop"?

A) c-ares

B) V8

C) libuv

D) events

Question #49

When you require('something'), where will Node.js attempt to resolve "something"?

A) Local .modules folder

B) Local node_modules folder then parents' node_modules folders

C) The .modules folder under the home directory

D) A something.js or a something folder that exists on the same level as the requiring file

Question #50

Which of the following modules is not a built-in module in Node.js?

A) net

B) ftp

C) https

D) http2

Question #51

Which of the following is not a Node global object?

A) exports

B) setTimeout

C) process

D) Buffer

Question #52

When a JavaScript function is invoked (called) in Node, a new "frame" is placed in:

A) The Events Queue

B) The Call Stack

C) The Poll Phase

D) The Event Loop

Question #53

What Node CLI option can be used to execute a JavaScript string and print its result to the screen?

A) -r

B) -e

C) -p

D) -c

Question #54

Is there a way to have Node always run in "strict mode"?

A) You can use the V8 option --use-strict

B) You have to use an external tool for that

C) Only if you are using ES modules

D) Only if you are using Chakra as the VM

Question #55

Which of the following is not a Node repl command?

A) .history

B) .break

C) .editor

D) .save

Question #56

Which global object acts like a bridge between a Node script and the host OS?

A) v8

B) process

C) child_process

D) env

Question #57

Which of the following special objects is an instance of EventEmitter?

A) Buffer

B) process

C) require

D) root

Question #58

Which process event is fired right before a Node process crashes and exits?

A) quit

B) crash

C) uncaughtException

D) error

Question #59

Which of the following is not a standard input/output stream in Node?

A) process.stdout

B) process.stdinfo

C) process.stdin

D) process.stderr

Question #60

What does a release incrementing the third (last) number in a SemVer string communicate to consumers about the release changes?

A) Changes are not backward compatible

B) Changes are just bug fixes and no new features were added

C) Changes will add new functionalities but will not break any existing code

D) Changes might not be backward compatible and might break existing code

Question #61

What does the .node file extension mean?

A) A JavaScript file can have a .node extension as well as the .js extension

B) A C++ addon file that is built with node-gyp and requirable in Node

C) A C++ file can have a .node extension and Node will be able to execute that file directly

Question #62

If you have a script.js file with this single line:


What will the output of executing node script.js be?

A) ReferenceError: arguments is not defined

B) undefined

C) An empty string

D) An object representing an array that has 5 elements

Question #63

In Node.js, what is a difference between require('dep') and import 'dep' for loading a dependency?

A) "require" works for local files and modules while "import" only works for modules

B) "require" is dynamically evaluated while "import" is statically evaluated

C) "require" is statically evaluated while "import" is dynamically evaluated

D) There is no difference. Both do the exact same thing.

Question #64

How does Node handle waiting on slow I/O operations?

A) By executing every operation in its own thread

B) By forking a process for every operation

C) Using the Event Loop

D) Using the Call Stack

Question #65

Which statement is true about Node’s Event Loop?

A) The Event Loop has 4 queues of callbacks to execute

B) The Event Loop has one queue for its own threads, and another queue for the OS threads

C) Each of the Event Loop phases has a queue of callbacks to execute

D) The Event Loop works with a single queue of callbacks to execute

Question #66

What is one advantage that event emitters objects have over the single callback pattern?

A) Event emitters can be "promisified" while callbacks can’t

B) Event emitters have a higher priority over single callbacks

C) Event emitters do not have the nested callback problem

D) With event emitters, you can define multiple handlers to work with an asynchronous result

Question #67

How can you use the Promise API with a callback-based function like child_process.exec?

A) util.promisify(child_process.exec())

B) new Promise(child_process.exec)

C) new Promise(child_process.exec())

D) util.promisify(child_process.exec)

Question #68

If you have a module x which exports a generator function (as its top-level API), which of the following code snippets is a way to work with x?


const x = require('x')();



const x = require('x');



const x = require('x')();



const x = require('x');


Question #69

Given that EventEmitter is in scope, which line of code will have an event emitter emitting a "CHANGE" event?

A) EventEmitter.new().emit('CHANGE');

B) EventEmitter.emit('CHANGE');

C) new EventEmitter('CHANGE');

D) (new EventEmitter()).emit('CHANGE');

Question #70

If you have a Readable stream x, which request listener function below will properly stream the content of x for an incoming http request?


const requestListener = (req, res) => {


const requestListener = (req, res) => {


const requestListener = (req, res) => {


const requestListener = (req, res) => {

Question #71

Which of the following objects is a stream?

A) process.stdout

B) Buffer

C) process.uptime

D) process

Question #72

Which line is the correct way to pipe a readable source and writable destination streams?

A) readableSrc.on('pipe', writableDest)

B) wrtibaleDest.on('pipe', readableSrc)

C) wrtibaleDest.pipe(readableSrc)

D) readableSrc.pipe(writableDest)

Question #73

Which is a correct way to execute the command ps -ef with a child process in Node? (Assume that the child_process module methods are in scope)

A) spawn("ps -ef")

B) exec("ps", "-ef")

C) exec("ps -ef")

D) fork("ps -ef")

Question #74

Which statement is true when you run: fork("script.js")

A) The forked process will have its own VM instance

B) The forked process shares the event loop with the parent process

C) A new VM instance is created and the two VM instances will be shared between the forked process and the parent process

D) The forked process shares the same VM thread with the parent process

Question #75

Which built-in Node.js module can be used to take advantage of multi-core systems?

A) net

B) os

C) util

D) cluster

Question #76

Which built-in Node module can be used for testing?

A) assert

B) jest

C) mocha

D) chai

Question #77

What does the zlib module provide?

A) Compression functionality implemented using Gzip, Deflate/Inflate.

B) Logging functionality for middleware

C) Bindings for working with HTML5 websockets

D) An easier to use API wrapping OpenSSL

Question #78

Which Node.js module can you use to compile and run JavaScript code in a sandbox environment?

A) v8

B) vm

C) sandbox

D) exec

Question #79

Which of the followings is a built-in module in Node?

A) crpyto

B) webpack

C) request

D) chalk