Node.js Flashcards

1
Q

What is Node.js?

A

A program that allows JavaScript to be run outside of a web browser.

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

What can Node.js be used for?

A

It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

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

What is a REPL?

A

Read-eval-print_loop; A simple development environment that takes single user inputs executes them, and returns the result to the user.

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

When was Node.js created?

A

Node.js was created in 2009 by Ryan Dahl.

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

What back end languages have you heard of?

A

PHP, Java, Ruby, and Python

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

What is a computer process?

A

An instruction currently being carried out by the computer.

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

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

100+

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

Why should a full stack Web developer know that computer processes exist?

A

So you can understand how the computer interprets instructions and make your programs more efficient.

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

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

A

A global object 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
10
Q

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

A

Since it’s a global object you can just reference it by name.

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

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

A

An array of strings.

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

What is a JavaScript module?

A

A JavaScript file.

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

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

A

__filename, __dirname, require, exports, module

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

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

A

console, process, setInterval, setTimeout, clearInterval, clearTimeout, global

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

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

A

So that we can access files from elsewhere in the code (another module).

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

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

A

With the require method.

17
Q

What is the JavaScript Event Loop?

A

The event loop checks if the stack is clear so it can push callbacks to the stack from the task queue.

18
Q

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

A

‘blocking’ code is on the stack, ‘non-blocking’ is on the queue.

19
Q

What is a directory?

A

A location for storing files.

20
Q

What is a relative file path?

A

A path to another file based off of the current location.

21
Q

What is an absolute file path?

A

A path to a file based off of the root directory.

22
Q

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

A

The fs module.

23
Q

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

A

fs.writeFile( file, data, callback)

24
Q

Are file operations using the fs module synchronous or asynchronous?

A

Asynchronous