Interview Questions for Web Developer - Web / Security
Tags: web, interview
Published: 2024-01-01 10:36:58

**1. Describe all levels of OSI model?**
The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven abstraction layers. Each layer performs specific tasks that facilitate communication between devices in a network. Here are the seven layers of the OSI model, starting from the bottom
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6f6lyha8u29jxpakg3jc.png)

**2. What is the difference between TCP and UDP protocols?**
TCP (Transmission Control Protocol) is a connection-oriented protocol that ensures reliable and ordered data delivery with error checking and retransmission, while UDP (User Datagram Protocol) is a connectionless protocol that provides faster but less reliable data transmission without error correction or guaranteed delivery.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb9f1g7p3fl42lm64tov.png)

**3. What is the difference between HTTP and HTTPS protocols?**
HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) are both protocols used for transmitting data over the internet. The primary difference lies in their security mechanisms:

- HTTP (Hypertext Transfer Protocol): It transmits data between a web server and a web browser, operating over a plain text communication, which means the data exchanged is not encrypted. This lack of encryption makes it vulnerable to interception or modification by attackers, compromising data integrity and confidentiality (**_works on port 80_**).

- HTTPS (Hypertext Transfer Protocol Secure): HTTPS incorporates encryption through SSL/TLS protocols, providing a secure and encrypted connection between the web server and the browser. This encryption ensures that data transmitted between the server and the client is encrypted, making it significantly more secure and safeguarding sensitive information such as login credentials, personal details, and financial transactions (**_works on port 443_**).

In summary, HTTPS adds a layer of security by encrypting data exchanged between the server and the client, while HTTP does not employ encryption, leaving data vulnerable to potential interception or tampering.

**4. Name base HTTP request methods, what are the differences between them?**

- _**GET**_: The purpose of the GET method is to request data from a specified resource, the data can be passed with a GET request inside a URL query string.
- _**POST**_: The purpose of the POST method is to submit data to a specified resource, the data can be passed with a POST request inside a URL query string and request body.
- _**PUT**_: The purpose of the PUT method is to send data to a specified resource for updating, the data can be passed with a PUT request inside a URL query string and request body.
- _**DELETE**_: The purpose of the DELETE method is to delete the specified resource identified by the URL.

**5. What are HTTP status codes, give examples of the most common ones?**
HTTP status codes are three-digit numbers returned by a server in response to a client's request made to a web server via HTTP. These codes indicate the outcome of the request and help to diagnose and troubleshoot issues encountered during communication between the client (like a web browser) and the server.

**_1xx Informational_**:

- 100 Continue: The server confirms the client's request and asks the client to proceed with the rest of the request.

**_2xx Success:_**

- 200 OK: The request was successful, and the server provides the requested content.

- 201 Created: The request has been fulfilled, resulting in the creation of a new resource.

- 204 No Content: The server successfully processed the request but doesn't need to return any content.

**_3xx Redirection:_**

- 301 Moved Permanently: The requested resource has been permanently moved to a new URL.

- 302 Found (or Moved Temporarily): The requested resource temporarily resides under a different URL.

**_4xx Client Errors:_**

- 400 Bad Request: The server cannot process the request due to a client error in the request syntax.

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

- 404 Not Found: The requested resource could not be found on the server.

**_5xx Server Errors:_**

- 500 Internal Server Error: A generic error message indicating that something has gone wrong on the server.

- 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance.



---