Node.js Flashcards

1
Q

What is Node.js?

A

an asynchronous event-driven JavaScript runtime environment that executes
JavaScript code outside 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

foundation of a web library or framework used for back-end application

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 interactive computer programming 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

2009

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

Python, PHP, Ruby

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

What is a computer process?

A

the instance of a computer program that is being executed by one or many threads

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

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

A

a global variable 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
9
Q

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

A

just use the process variable (it’s global)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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
11
Q

What is a JavaScript module?

A

each JavaScript file is a module

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

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

A

exports, require(), module, __dirname, __filename

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

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

A

process, console

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

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

A

to use variables and functionalities from other modules

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

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

A

require(‘relative file path’)

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

What is the JavaScript Event Loop?

A

monitors the Call Stack and the
Callback Queue.
If the Call Stack is empty, it will take the first event from the
Callback queue and will push it to the Call Stack, which effectively runs it

17
Q

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

A

blocking code is executed in sequence – each statement waits for the previous statement to finish before executing
non-blocking code doesn’t have to wait – your program can continue to run

18
Q

What is a directory?

A

A folder

19
Q

What is a relative file path?

A

file path from the current working directory

20
Q

What is an absolute file path?

A

file path from the root directory
root === /

21
Q

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

A

File System (fs) module

22
Q

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

A

fs.writeFile

23
Q

Are file operations using the fs module synchronous or asynchronous?

A

both, depends on which one you use