Node.js Flashcards

1
Q

What is Node.js?

A

a program that allows JavaScript to be run outside of a web browser. Commonly used to build back ends for Web applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a REPL?

A

Read-eval-print-loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the process object in a Node.js program?

A

The process object is a global that provides information about, and control over, the current Node.js process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you access the process object in a Node.js program?

A

simply process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the data type of process.argv in Node.js?

A

Array of strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a JavaScript module?

A

a single js file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What values are passed into a Node.js module’s local scope?

A

module, exports, require, __filename, __dirname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Give two examples of truly global variables in a Node.js program.

A

process, console, global

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of module.exports in a Node.js module?

A

so that we can import using require function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you import functionality into a Node.js module from another Node.js module?

A

use require function with path to file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the JavaScript Event Loop?

A

Event loop is something that monitors the Call Stack and the Callback Queue. If the Call Stack is empty, the first event from the queue is pushed to the Call Stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

blocking is when call stack is not empty and is being processed for a long time. non-blocking is multiple Callbacks queued so that event loop can effectively handle code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What module does Node.js include for manipulating the file system?

A

file system (fs/fs.js)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Are file operations using the fs module synchronous or asynchronous?

A

Asynchronous with callback functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly