Web Dev Fundamentals Flashcards

1
Q

What is a client?

A

A machine that requests data or services from a server. In the case of the web, browsers are clients that request HTML pages from servers.

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

Can a single machine be both a client and a server?

A

Yes, a machine can be both a client and a server at the same time. For instance, a single machine could act as a server for end users and as a client for a database.

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

What is a server?

A

A server is a machine that provides data or services for a client.

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

What is the client-server model?

A

The client-server model is a paradigm where clients request data or services from servers, and servers provide data or services to clients. (Request response cycle)

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

What happens when you go to www.google.com?

A

We run through the system of Domain Name System (DNS)

Your browser looks in local cache to see if website was visited before and is IP address is known. If the IP address can’t be found, we go through the rest of the Domain Name System process

  • Goes to resolving name server, if it doesn’t know IP address it’s looking for (algoexpert.io),
    it will then look in the root name server.
  • Root name server knows how to locate IP addresses of all top level domain servers (.io) (.com) etc.
  • Root name server tells the resolving name server where the top-level domain server is
  • Resolving name server then asks the top level domain name server, which tells it where to look in the authoritative name server
  • The authoritative name server returns the IP address to the resolving name server, which then finally returns it back to our computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Break down this url:
https://www.algoexpert.io:443/frontend

A

https: scheme/protocol
www: subdomain
algoexpert: domain
.io: top-level domain
443: port
/frontend: path

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

What is an IP address?

A

A unique identifier for a computer on the internet

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

How to find an IP address for a computer on the internet?

A

We use the Domain Name System (DNS)

  • converts domain name to IP addresses:
    • Example: algoexpert.io => 35.202.194.70
  • Always checks local cache before making a network request, so we don’t need to make repeated network requests for an IP address.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is TCP?

A

TCP stands for Transmission Control Protocol. It is a way for the client and server to make sure they’re on the same page on how they’re going to send information from one computer to the other.

TCP is a connection-oriented protocol, which means that it requires a connection to be established between two devices before data can be sent.

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

What is HTTP?

A
  • In simplified terms, HTTP is an agreement that is made between clients and servers regarding how they are going to format their messages so they can understand each other
  • A protocol for transmitting “hypermedia” (complex files) on the web
  • Stateless protocol
    • One message at a time without memory of previous requests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Common Status Codes:
200, 201

A

200 : OK
201: Created

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

Common Status Codes:
301, 302

A

301: Moved Permanently
302: Found (Moved Temporarily)

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

Common Status Codes:
400, 401, 403, 404

A

400: Bad Request
401: Unauthorized
403: Forbidden

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

Common Status Codes:
500, 503

A

500: Internal Server Error
503: Service Unavailable

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

What is HTTPS?

A
  • A more secure version of HTTP
  • Issue of HTTP is that everything is sent with plain text
  • Uses TLS (or SSL) to encrypt requests/responses
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an API?

A

Allows computers to communicate with each other

17
Q

What is REST?

A
  • Representational State Transfer
  • An architectural style
  • Set of architectural constraints:

**Remember first two!!!
- Client-server model (independent of each other)
- Stateless (each request must contain all of the information necessary to be understood by the server, rather than be dependent on the server remembering prior requests)

  • Cacheable (An endpoint should define whether or not it is cacheable)
  • Layered System (client should not need to know which server it is connected to)
  • Uniform interface
18
Q

What is Same-Origin Policy?

A

A policy limiting the ability of a page from reading resources from different origins. Two resources are from the same origin only if they have the same protocol, host, and port.

18
Q

What is Same-Origin Policy?

A

A policy limiting the ability of a page from reading resources from different origins. Two resources are from the same origin only if they have the same protocol, host, and port.

19
Q

What is an XSS attack?

A

XSS stands for cross-site scripting attack. It is An attack where an attacker is able to run code on a vulnerable site, thus circumventing the same-origin policy.

E.g: Attackers inject javascript code into UI

20
Q

What is a CSRF attack?

A

CSRF stands for cross-site request forgery attack. An attack sends a request to a server and is able to convince the server its client sent it.

21
Q

How to prevent a CSRF attack?

A

Utilizing a CSRF token, which is a unique token given to the client that a forged request would not be able to replicate.

22
Q

What is CORS?

A

CORS stands for cross-origin resource sharing. A server can allow cross-origin requests by including the access-control-allow-origin header.

23
Q

How to prevent an XSS attack?

A
  • Always use textContent/innerText when adding dynamic text (avoid innerHTML)
  • Sanitize/escaping user input *** (important!!!!)
  • Add HTTP only flag to sensitive cookies
24
Q

What is OAuth?

A

Open Authorization allows users to give other services specific API access to portions of their accounts without passwords.

25
Q

What are the sections of a JSON Web Token?

A

JSON Web Tokens (JWTs) have three sections:
- Header with information about the encryption algo used
- The payload data
- The signature, which is created by the server using a secret key so that it can determine if it has been tampered with

25
Q

What are the sections of a JSON Web Token?

A

JSON Web Tokens (JWTs) have three sections:
- Header with information about the encryption algo used
- The payload data
- The signature, which is created by the server using a secret key so that it can determine if it has been tampered with

26
Q

How does a browser convert frontend files into a UI?

A

Critical Rendering Path:
1. Parse HTML into DOM tree
2. Parse CSS into CSS Object Model tree
3. Combine DOM and CSS Object Model into render tree
4. Layout (figures out where to place each node)
5. Paint (go through each pixel and paint the screen)

27
Q

What is a class?

A

A blueprint/template that describes the details of an object

28
Q

What are the basic concepts of OOP?

A

Abstraction, Encapsulation, Inheritance, Polymorphism

29
Q

What is Encapsulation?

A

Encapsulation refers to the bundling of data with the methods that operate on that data. Encapsulation is used to hide the values or state of a structured data object inside a class, preventing direct access to them by clients

30
Q

What is Polymorphism?

A

Polymorphism is the ability to take more than one form.

E.g. Shape class and classes can inherit from it (square, triangle, etc).

31
Q

What is Inheritance?

A

Inheritance is the ability of one class to inherit the attributes and methods of another class

32
Q

What is Abstraction?

A

Abstraction is the process of hiding the implementation details of an object so that it can be used without understanding how it works

33
Q

What is Web Assembly (WASM)?

A

A binary instruction format that’s a compile target for languages like C, C++, enabling them to run on the web at near-native speed.