Node.js Flashcards

1
Q

What is Node.js?

A

built on chrome’s JavaScript runtime for building fast and scalable network applications. uses event-driven non-blocking I/O model. JavaScript without the 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

you can do anything with networking with it, though not suggested for 3d graphics, can only be back-end

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, interactive toplevel or language shell. Takes single user inputs, executers them, and returns the result to the user, and is executed piecewise. Ex. console

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

When was Node.js created?

A

May 27, 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

ruby, python, php, sql (a database for languages), java, JavaScript

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

What is a computer process?

A

a process contains a program code and its activity, it is executers in 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

Currently I have 226

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

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

A

A full stack web developer helps make multiple processes work together to form one application, so knowing about computer processes is important, especially since we’re using clients, servers, and databases

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 the Node.js program?

A

node and the node command process, cause 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

a file containing related code, used to be called scripts

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

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

None of them are truly global, but __filename, __dirname, exports, module, and require are global in the scope of modules

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

None of them are truly global, but __filename, __dirname, exports, module, and require are global in the scope of modules. console & process are truly global

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

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

A

export a file to another file

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

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

A

require function, require()

17
Q

What is the JavaScript Event Loop?

A

constant process of callstack being put back on the callstack queue

18
Q

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

A

non-blocking is when the queue is cleared and can continue, blocking is when something is on the callstack

19
Q

What is directory?

A

a folder, a collection of files created for a purpose

20
Q

What is a relative file path?

A

location that is relative to a current directory

21
Q

What is an absolute file path?

A

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

22
Q

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

A

fs (file system) module

23
Q

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

A

writeFile method

24
Q

What is a client?

A

wants data

25
Q

What is a server?

A

gives data

26
Q

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

A

GET

27
Q

What is the first line of an HTTP request message?

A

method, request target, target

28
Q

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

A

http version number, status code, reason phrase

29
Q

What are HTTP headers?

A

additional information of key value pairs to give. let client and the server pass additional information with an http request or response

30
Q

Is a body required for a valid HTTP message?

A

No, Get for without body, Post for with body

31
Q

What is NPM?

A

package manager (website, registry, command line)

32
Q

What is a package?

A

packages is a directory with one or more files in them, including package.json

33
Q

How can you create a package.json with npm?

A

cd /path/to/package , npm init –yes

34
Q

What is a dependency and how do you add one to a package?

A

npm install , packages required by your application in production.

35
Q

What happens when you add a dependency to a package with npm?

A

npm will download dependencies and devDependencies that are listed in package. json that meet the semantic version requirements listed for each.