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 inter user face

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
  • cat
  • ls
  • pwd
  • echo
  • touch
  • mkdir
  • mv
  • rm
  • cp
A
man -> manual
cat -> see the contents of files
ls -> shows list of directories/files of current branch
pwd -> shows current branch
echo -> 'text' appears on terminal
touch -> creates a file 
mkdir -> creates a directory/folder
mv -> move or rename a file
rm -> remove (danger)!!
cp -> copy
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, and hubris

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

What is Node.js?

A

javascript environment that is not in a browser

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

anything you can do with programs

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

What is a REPL?

A

request and sends such as javascript console log

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

When was Node.js created?

A

2009

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

data model of running program

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

object of an array with strings

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

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

A

process.argv[2,3,4,…]

for loop i starts 2 not 0

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

What is a JavaScript module?

A

js files that are in the directories

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

object, exports, require, __dirname, __filename, 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

process, global

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

What is the JavaScript Event Loop?

A

function executes and if send request -> put it aside and when receive it put in on queue and runs when the stack is cleared

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

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

A

blocking -> if executing functions, cannot run other function
non-blocking -> event-loop

16
Q

What is a directory?

A

folder that contains files

17
Q

What is a relative file path?

A

location that is relative to a current directory

18
Q

What is an absolute file path?

A

the root element and the complete directory list required to locate the file.

19
Q

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

20
Q

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

A

Use JSON.stringify(data, null, 2)
(2 is indentation)
fs.writefile(‘filename’, data, ‘utf8’, callback function)

ex. const stringjson = JSON.stringify(json, null, 2);
fs.writeFile(‘data.json’, stringjson, ‘utf8’, err => {
if (err) {

21
Q

Are file operations using the fs module synchronous or asynchronous?

22
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

23
Q

What is on the first line of an HTTP response message?

A

version, status code, status message

24
Q

What are HTTP headers?

25
Q

Is a body required for a valid HTTP message?

A

no because it appears after header