Node.js Flashcards

1
Q

What is Node.js

A

Node.js is 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 apps, 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 REPL?

A

Read-Eval-Print Loop

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

When was Node.js created?

A

2009 by Ryan Dahl

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

What other back end languages have you heard of?

A

Ruby, PHP, Java, c#, Python, C, C++, Swift (Not common for back end though feasible), Objective C (not common for back end though feasible), JavaScript, Perl, Go, Erlang, Elixir.

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

What is CLI?

A

Command Line Interface

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

What is GUI?

A

Graphical User Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
Give at least one use case for each command listed in this exercise:
man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
A

man: Look up manuals
cat: Concatenate files and print on the standard output.
ls: list items in the directory.
pwd: print name of current/working directory.
echo: Display a line of text
touch: Make new files or update timestamps.
mkdir: Makes new directories
mv: Move (rename) files
rm: Remove files or directories.
cp: Copy files or directories.

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

What are the three virtues of a great programmer?

A

impatience, laziness, hubris.

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

What is a computer process?

A

The instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.

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

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

A

300

101 Windows Processes
98 Background Processes
11 Apps

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

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

A

Because we are making multiple processes work together to form one application.

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

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

A

It is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require().

It is also an instance of EventEmitter.

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

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

A

node command then process

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

What is a JavaScript Module?

A

It is a single .js file

17
Q

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

A
\_\_dirname
\_\_filename
exports
module
require()
18
Q

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

A
clear immediate function
setInterval
setTimeout
process
global
19
Q

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

A

export the data inside the file to another module.

20
Q

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

A

assign require(‘./filename’); to a new variable. const banana = require(./banana);

21
Q

What is the JavaScript Event Loop?

A

A loop that checks the stack and the task queue and pushes the task queue onto the stack once its clear.

22
Q

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

A

Blocking clogs up the stack and prevents anything else from happening until that code is done running. Non-blocking pushes code into the api then into the task queue to be run once it’s completed its processing leaving the user with the ability to continue working.

23
Q

What is a directory?

A

A folder which allows users to group files into separate containers.

24
Q

What is a relative file path?

A

A location that is relative to a current directory. Also known as a folder.

25
What is an absolute file path?
An absolute file path always contains the root (/) element and the complete directory list required to locate the file.
26
What module does Node.js include for manipulating the file system?
fs
27
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile
28
Are file operations using the fs module synchronous or asynchronous?
Both.