Web concepts Flashcards

(71 cards)

1
Q

What status codes means?
100s

A

100s - Informational

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

What status codes means?
200s

A

200s - Success

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

What status codes means?
300s

A

300s - Redirection

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

What status codes means?
400s

A

400s - Client error

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

What status codes means?
500s

A

500s - Server error

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

What is the View Transition API?

A

A modern web API that enables smooth, animated transitions between different states or pages in web applications.

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

What is the main benefit of using the View Transition API?

A

It creates visually engaging transitions that enhance user experience by reducing perceived load times and maintaining context during navigation.

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

Where can you use the View Transition API?

A

You can use it in both single-page applications (SPAs) and multi-page applications (MPAs).

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

What is a same-document view transition?

A

A transition that animates DOM changes within a single page, typically used in SPAs.

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

What is a cross-document view transition?

A

A transition that animates navigation between different pages, typically used in MPAs.

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

How does the View Transition API work at a high level?

A

It captures snapshots of the current and new page states, overlays them, and animates the transition using CSS.

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

What function triggers a view transition in JavaScript?

A

document.startViewTransition()

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

What happens when document.startViewTransition() is called?

A

The browser takes a screenshot of the current state, applies DOM changes, takes another screenshot, and animates between them.

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

How is the default cross-fade animation achieved in the View Transition API?

A

The old view fades out (opacity 1 to 0) and the new view fades in (opacity 0 to 1) using CSS animations.

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

How can you customize the animation of a view transition?

A

By styling the ::view-transition pseudo-elements with CSS.

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

What is the purpose of view-transition-name in CSS?

A

It tags specific elements so they can be animated individually during a transition.

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

What is the structure of the pseudo-elements used during a view transition?

A

::view-transition > ::view-transition-group(root) > ::view-transition-image-pair(root) > ::view-transition-old(root) and ::view-transition-new(root)

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

What does the HTTP status code 200 indicate?

A

The request has succeeded.

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

What does the HTTP status code 404 signify?

A

The requested resource was not found.

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

True or False: The status code 500 indicates a server error.

A

True

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

Fill in the blank: The HTTP status code ___ means ‘Unauthorized’.

A

401

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

Which HTTP status code indicates that the request was successful but no content is returned?

A

204

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

What does the status code 301 represent?

A

Moved Permanently.

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

What is the meaning of the HTTP status code 403?

A

Forbidden - the server understands the request but refuses to authorize it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Multiple choice: Which of the following codes indicates a temporary redirect? A) 302 B) 404 C) 500
A) 302
26
What does the HTTP status code 400 mean?
Bad Request - the server could not understand the request due to invalid syntax.
27
True or False: The status code 503 means the service is unavailable.
True
28
Fill in the blank: The HTTP status code ___ indicates 'Created'.
201
29
What does the status code 408 signify?
Request Timeout - the server timed out waiting for the request.
30
What does the HTTP status code 429 indicate?
Too Many Requests - the user has sent too many requests in a given amount of time.
31
Multiple choice: Which status code indicates that the server is currently unable to handle the request? A) 500 B) 200 C) 404
A) 500
32
What does the HTTP status code 301 mean?
Moved Permanently.
33
True or False: The status code 401 indicates that authentication is required and has failed.
True
34
Fill in the blank: The HTTP status code ___ indicates 'No Content'.
204
35
What does the status code 503 mean?
Service Unavailable - the server is currently unable to handle the request due to temporary overload or maintenance.
36
What does the HTTP status code 302 indicate?
Found - the resource has been temporarily moved to a different URI.
37
Multiple choice: Which status code means 'Not Acceptable'? A) 406 B) 404 C) 200
A) 406
38
What is the difference between 401 and 403 status code?
39
What is a cookie in web development?
A small piece of data stored on the user's computer by the web browser while browsing a website.
40
True or False: Cookies can only store text data.
True
41
Fill in the blank: Cookies are sent to the server with each __________ request.
HTTP
42
What is the maximum size of a cookie?
Typically 4KB (4096 bytes).
43
Which attribute of a cookie specifies the duration for which the cookie should be stored?
Expires or Max-Age
44
What is the purpose of the HttpOnly attribute in cookies?
It prevents client-side scripts from accessing the cookie, enhancing security.
45
True or False: Cookies can be used to track user sessions across multiple visits.
True
46
Multiple Choice: Which of the following is NOT a type of cookie? A) Session Cookie B) Persistent Cookie C) Temporary Cookie
C) Temporary Cookie
47
What does the SameSite attribute in cookies help prevent?
Cross-site request forgery (CSRF) attacks.
48
Short Answer: How can you delete a cookie in web development?
By setting its expiration date to a past date or using the 'max-age' attribute with a negative value.
49
What is Cookie Domain attribute?
Specifies which hosts can receive the cookie. Defaults to the domain that set it.
50
What is Cookie Path attribute?
Limits the cookie to a specific path within the domain.
51
What is Cookie Expires/Max-Age attribute?
Controls the cookie's lifetime (session vs. persistent).
52
What is Cookie Secure attribute?
Ensures the cookie is sent only over HTTPS.
53
What is Cookie HttpOnly attribute?
Prevents JavaScript access, mitigating XSS attacks.
54
What is Cookie SameSite attribute?
Controls cross-site sending of cookies (Lax, Strict, or None).
55
What are XSS attacks?
Type of web security vulnerability where attackers inject malicious scripts—most often JavaScript—into otherwise trusted websites or web applications. When unsuspecting users visit these compromised pages, their browsers execute the injected code as if it were part of the legitimate site, allowing attackers to hijack user sessions, steal sensitive data (like cookies or session tokens), impersonate users, or modify website content.
56
What are Session Cookies?
Temporary, deleted when the browser closes. Used for things like shopping carts.
57
What are Persistent Cookies?
Remain after the session, storing long-term preferences or login info.
58
What are Third-Party Cookies?
Set by domains other than the one in the address bar, mainly for advertising/tracking. Increasingly blocked by browsers for privacy reasons.
59
Provide Fullstack Session Management Example
User logs in: Server generates a session ID, stores session data server-side, and sends the session ID as a cookie. User navigates: Browser sends the session cookie with each request. Server validates session: Server uses the session ID from the cookie to retrieve user data and maintain state. Security: Implement session expiration and consider token-based authentication for enhanced security.
60
Cookies vs session/local storage
session/local storage is not secure and can be edited by user. Cookies can have a flag HTTPOnly that can prevent user from editing this value.
61
What is oauth2?
OAuth2 is an open standard authorization framework that allows third-party applications to obtain limited access to user data from another service without sharing the user's credentials. fe. "Sign in with Google"
62
What is WebSocket?
WebSocket is a communication protocol that provides full-duplex communication channels over a single TCP connection.
63
True or False: WebSocket is a one-way communication protocol.
False
64
Fill in the blank: WebSocket connections are established through an initial __________ request.
HTTP
65
What is the main advantage of using WebSocket over traditional HTTP requests?
WebSocket allows for real-time, bidirectional communication without the overhead of repeatedly opening and closing connections.
66
Which HTTP status code indicates a successful WebSocket handshake?
101 Switching Protocols
67
What are the two main phases of a WebSocket connection?
Handshake and Data Transfer
68
Multiple choice: Which of the following is a valid use case for WebSocket? A) Live chat applications B) Static web pages C) File uploads D) Image rendering
A) Live chat applications
69
What is the purpose of the WebSocket API in web browsers?
The WebSocket API allows developers to create and manage WebSocket connections in web applications.
70
True or False: WebSocket connections can only be made from a web browser.
False
71
What is the difference between WebSocket and HTTP?
WebSocket provides a persistent connection for real-time communication, while HTTP is stateless and typically used for request-response communication.