Client-Server at an Interview
A simple quiz: client and server, request and response, HTTP and HTTPS, methods, codes 404 and 500, headers and body, DevTools.
Questions and explanations
Find an explanation for each question here. To test yourself, take the quiz above first.
How do you explain in simple words what a client and a server are?
Client and server are roles, not particular computers. The client asks, the server answers. The same service can be a server for one application and a client for another.
A user clicks “Sign in” on a website. What happens next?
The password is checked by the server, not by the browser: user data is stored on the server or in a database. The browser only sends the request and displays the response it gets.
What is the difference between HTTPS and HTTP?
HTTP sends data as plain text, HTTPS adds encryption (TLS). That is why pages with sign-in, payment and personal data must work only over HTTPS.
Which HTTP method is usually used to get a list of products without changing anything on the server?
GET requests data and must not change it. POST usually creates, PUT and PATCH update, DELETE removes.
What is the difference between response codes 404 and 500?
4xx codes point to a mistake in the client’s request, 5xx to a mistake on the server side. The first digit of the code already tells you where to look for the problem.
What are the headers and the body of an HTTP request?
The Content-Type header tells the server the format of the data, Authorization tells who sent the request. A body is usually present in POST, PUT and PATCH, and usually absent in GET.
How can you see which requests a website sends without using Postman?
In the Network tab you can find a request and check the method, URL, response code, and the request and response bodies. It is a tester’s main tool in web testing.
The interface shows an error when saving a form. How do you tell where the problem is: on the client or on the server?
The request and response are the boundary between the client and the server. By checking them, you can state in the bug report where exactly the problem is, and the developer will find the cause faster.