Node.js Flashcards

1
Q

What is a CLI?

A

Command-line interfaces

Processes commands to a computer program in the form of lines of text

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

What is a GUI?

A

Graphical user interface

Allows users to interact with electronic devices through graphical icons and audio indicators

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

Give at least one use case for each of the commands listed in this exercise.

A

man - To look up command information
cat - Print contents of files to see what they are
ls - See a list of the contents in a directory
pwd - To see the current working directory
echo - Kind of like console.logging. To see the status of something?
touch - To set the access date or modify a date of a file/directory
- *To create files
mkdir - To create directories
mv - To rename a file or directory
- To move a file/directory, because renaming something technically changes location
rm - To delete a file/directory
cp - To copy something, kind of like “save as” in programs

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

What are the three virtues of a great programmer?

A

Laziness, impatience, hubris

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

What can Node.js be used for?

A

Build scalable network applications

Single-threaded event loop model

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

What is a REPL?

A

Read-eval-print loop or language shell
Simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.
(browser console)

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

What back end languages have you heard of?

A

Python, Elixir, ruby, PHP, SQL, Java, C++, Go, C#, JavaScript, VBA, Clojure, C, Julia, Haskell, Pascal, Rust, Lisp, Perl, TypeScript, Objective-C, Swift, Kotlin, Scala
*PHP, Ruby, Python, JavaScript, Perl - very similar, just know for the job interviews or something. “What is the diff between javascript vs java
Javascript is the only one with event loop

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

Like 100 or more

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 FSWB is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary.
This will be extremely important when learning about applications made of multiple components, such as clients, servers, and databases.

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

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 can also be explicitly accessed using require().

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

console. log(?)

* can just pull it out of thin air

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

It returns an array containing the command-line arguments passed when the Node.js process was launched.
*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

A single .js file

17
Q

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

A
\_\_dirname
\_\_filename
Exports
Module
require(id)
18
Q

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

A

AbortController

AbortSignal

19
Q

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

A
To allow the module to be an instance. It’s what allows these files to be used by assigning them to the module.exports object.
* if you want to make something available within a separate program, is to export it. We take our value/function/, etc, assign it to module.exports. So we can call it in another module.
20
Q

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

A
By assigning the module to the module.exports object and calling it in the require function…?
* require(‘./add’)
21
Q

What is a directory?

A

Collection of files created for organizational purposes

22
Q

What is a relative file path?

A

Location that is relative to a current directory

23
Q

What is an absolute file path?

A

Always contains the root element and the complete directory list required to locate the file

24
Q

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

A

‘fs’

25
Q

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

A

fs. write()

* writeFile method

26
Q

Are file operations using the fs module synchronous or asynchronous?

A
Asynchronous…?
*both, fs module has both synchronous and asynchronous