Node.js Flashcards

1
Q

What is a CLI?

A

command line interface

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

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.
man

A

manual -> look up manual for specific commands

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

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

A

Print standard output of a file or concatenate content of files and print out

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

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

A

List out current files and directory within the current directory

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

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

A

Print working directory

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

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

A

display line of text

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 of the commands listed in this exercise.
touch

A

make file timestamp

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

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

A

Create new directory

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

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

A

Move or rename a file or directory
mv old_name new_name

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

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

A

Remove (delete) a file or directory (-r)

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

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

A

Make copy of file or directory (-r)

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

What is Node.js?

A

JavaScript runtime environment

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

What can Node.js be used for?

A

to built back end
automated scripts
command line programs

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

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

A

an object that provides information about, and control over, the current Node.js process.

17
Q

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

A

const variableName = require(“node:process”);

18
Q

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

A

Array of string

19
Q

What is a JavaScript module?

A

file that contain related codes

20
Q

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

A

exports, require, module, __filename, __dirname

21
Q

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

A

process, console

22
Q

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

A

to give access to the variable to be used on another file/module

23
Q

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

A

const variableName = require(‘pathOfFileToImport’);

24
Q

What is the JavaScript Event Loop?

A

part of a runtime environment => Look at the call stack, if stack is empty, push (asynchronous callback) task from task queue onto call stack operation

25
What is different between "blocking" and "non-blocking" with respect to how code is executed?
blocking - slow down the call stack non-blocking - does not slow down the call stack
26
What is a directory?
folder, the special file that list other files in directory
27
What is a relative file path?
how to get to somewhere relative to where you are currently
28
What is an absolute file path?
file location relative to the root directory
29
What module does Node.js include for manipulating the file system?
fs module
29
What method is available in the Node.js fs module for writing data to a file?
writefile()
30
Are file operations using the fs module synchronous or asynchronous?
both depend on the method used (sync or async methods)