Node Flashcards

1
Q

What does server-side programming allow us to do?

A
  • Deliver tailored content to individual users
  • Provides access to the underlying OS features, not usually available to client-side code.
  • Helps choose which content to render.
  • Can be written in any programming language.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does client-side programming allow us to do?

A
  • Helps define content and presentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why do programmers use web frameworks?

A

Web frameworks provide solutions to common problems (e.g., session management, authentication, data management)

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

What is

Node.js

A

Node.js is an open-source runtime environment for executing JavaScript outside the browser.

Developers can write server-side code in JavaScript.

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

What kind of architecture is Node.js?

A

Single-threaded event loop architecture

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

What is a

Single Threaded Event Loop Architecture

A

One process sequentially executes incoming requests and returns a response.

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

What is a

Multi-Threaded Request-Response Architecture

A

Every incoming request executes on a separate thread.

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

What does the Event Loop do?

A
  • It processes requests from the event loop sequentially.
  • If a request uses blocking operations, a new thread handles them, and the next request begins.
  • Otherwise, the request is processed, and a response is returned.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is nodemon used for?

A

Nodemon is used to automatically restart the app when you make changes.

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

When we write scripts that will never terminate, how should we terminate them?

There are two options.

A
  • Forcefully kill it (Not good)
  • Exit gracefully (Good)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the process module useful for?

A

The process module is useful for reading arguments passed to a script from the command line.

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

What happens in the

Message/Callback Queue

A

Asynchronous operations schedule their callbacks to be executed when the Event Loop reaches the appropriate phase.
* Executed after functions in the call stack are executed.
* Callbacks are executed in order (FIFO) unless microtasks interrupt.

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

What is a

Promise

A

It is an object that resolve before a function ends are executed right after the current function.

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