Node.js Flashcards

1
Q

What is Node.js?

A

program that allows JavaScript to be 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

build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

write web servers, mobile apps, general programming

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 (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user

REPL stands for Read Evaluate Print Loop, and it is a programming language environment (basically a console window) that takes single expression as user input and returns the result back to the console after execution. system that listens for typing in command and processes it

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

What is a computer process?

A

the instance of a computer program that is being executed by one or many threads.
environment in which program runs and executing code

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

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

A

to see which process is running the server ,database and understanding how the system works together

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

a global that provides information about, and control over, 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

const process = require(‘process’);
call the variable

in a node.js need to open it through node terminal and the js file

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 of strings

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 that has functions and variables that can be exported and used

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
the variables accessible in the local scope of that specific module

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

__dirname, __filename, exports, module, require()
global, 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

To allow using code from a module in another module
Way to expose things inside one module into another module

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

Module.exports = functionName in the exporting module
const varName = require(‘./jsFileName); in the import module

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

What is the JavaScript Event Loop?

A

The functionality in javascript that looks at the stack and if its empty, take the first thing on the queue and push onto the stack

mechanism for doing asynchronous code to run later or defer
way the system manages execution from taking code off the queue and running it, looping this system

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 prevents any code from running until the current code is finished, synchronous

event loop takes code off the queue, and the system is blocked while its running. if its non blocking, put another task on the queue so it runs right after
nonblocking - running things asynchronously, deferred until after

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

What is a directory?

A

A folder

17
Q

What is a relative file path?

A

location of a directory relative to another directory

18
Q

What is an absolute file path?

A

full length of the file from the root

19
Q

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

A

fs

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

asynchronous