Node Flashcards

1
Q

What is Node.js?

A

A program that allows javascript code to 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

websites and backend services

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) is the environment where code can be executed

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

What is a computer process?

A

The actual execution of a program; a process is an instance of a program

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

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

A

hundreds

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

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

A

global object that provides information about the current node.js process

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

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

A

use the global name process

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

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

A

array

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

What is a JavaScript module?

A

a .js file in node.js

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

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

A

exports, require, module, __filename, __dirname

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

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

A

process, console

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

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

A

a way to send data from one module(js file) to another

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

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

A

using the require function

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

What is the JavaScript Event Loop?

A

it runs asynchronous code separate from the call stack that does not block the normal flow of code

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 is code that prevents further code from running until the current task is completed, non-blocking is asynchronous

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

What is a directory?

A

a location that holds files

17
Q

What is a relative file path?

A

relative path do not start with /, but ‘..’

18
Q

What is an absolute file path?

A

absolute path starts with / and point to the root

19
Q

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

A

‘fs’ module

20
Q

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

A

fs.writeFile()

21
Q

Are file operations using the fs module synchronous or asynchronous?

A

.

22
Q

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

A

writeFile()

23
Q

Are file operations using the fs module synchronous or asynchronous?

A

both

24
Q

What is JSON?

A

data interchange form, with data type string

25
Q

What are serialization and deserialization?

A

Serialization is a process of converting an Object into stream of bytes so that it can be transferred over a network or stored in a persistent storage.

26
Q

How to you serialize data into a JSON string using JavaScript?

A

JSON.stringify()

27
Q

How do you deserialize a JSON string using JavaScript?

A

JSON.parse()