Example Questions Flashcards
What is a multi tier architecture project structure?
A multi tier architecture project structure is a client-server architecture in which the presentation, logic and data layers are physically separated. The structure consists of a Presentation layer, a Logic layer and a Data access layer.
What are the benefits and drawbacks of a multi tier architecture project structure?
Advantages:
- Scalable
- Increased security
- Reusable
Disadvantages:
- Increased effort
- Increased complexity
Describe the purpose of the different files and folders in a multi tier architecture web project.
Presentation Layer:
Contains files related to the user interface such as HTML, CSS and JavaScript files.
OR
Files related to returning resource data as a REST API.
Logic Layer:
Contains core business logic files (PHP). These files should include functions that are responsible for processing the data received from the presentation layer, as well as other functions that are used to manipulate the data.
Data Access Layer:
Contains files related to data storage, such
as the database configuration file, SQL queries, and functions that are responsible for interacting with the database.
What is the distinction and difference between backend and frontend programming?
Frontend development focuses on the visual aspects of a website - the part that users see and interact with.
Backend development comprises a sites structure, system, data and logic.
Explain HTTP in as much detail as you can.
HTTP stands for HyperText Transfer Protocol. It is a protocol for fetching resources such as HTML documents. HTTP can be used to control several things, for example authentication.
What is the request-response cycle in HTTP?
The request-response cycle involves communication between the browser (client) and server.
1. User issues URL from a browser (client).
2. Browser (client) sends a request message.
3. Server maps the URL to a file or program under the document directory.
4. Server returns a response message.
5. Browser (client) formats the response and displays.
Describe the purpose of status codes in HTTP, what types of codes there are and when to use each one.
The purpose of status codes in HTTP is to indicate whether a specific HTTP request has been successfully completed. Responses are grouped in 5 classes:
1. Informational responses
2. Successful responses
3. Redirection messages
4. Client error responses
5. Server error responses
Name some common status codes and what they mean.
200 (OK) - The request succeeded.
201 (CREATED) - The request succeeded and a new resource was created as a result.
202 (ACCEPTED) - The request has been received but not yet acted upon.
204 (NO CONTENT) - There is no content to send for this request, but the headers may be useful.
400 (BAD REQUEST) - The server cannot or will not process the request due to something that is perceived to be a client error.
404 (NOT FOUND) - The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist.
What is a REST API? Describe all parts of REST APIs in as much detail as you can.
A REST API is an Application Programming Interface that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer. You can think of an API as a mediator between the users or clients and the resources or web services they want to get.
Describe all parts of REST APIs in as much detail as you can.
The key elements of the REST API paradigm are the client, server and resource. Any REST request includes 4 parts: an HTTP method, an endpoint, headers, and a body.
HTTP method - describes what is to be done with a resource. POST, GET, PUT, DELETE or CRUD.
Endpoint - contains a URI indicating where and how to find the resource on the Internet. The most common type of URI is a URL, serving as a complete web address.
Headers - store information relevant to both the client and server. Mainly, headers provide authentication data — such as an API key, the name or IP address of the computer where the server is installed, and the information about the response format.
Body - is used to convey additional information to the server.
List the various HTTP-Methods (GET, POST, PUT, PATCH, and DELETE) and describe the purpose and uses of each one.
GET - used to retrieve data from a web server. Used in PHP to retrieve information from a database, such as a user profile or product catalog. A GET request is typically sent via a URL. GET response codes: 200 (OK), 400 (BAD REQUEST), 404 (NOT FOUND).
POST - is used to send data to a web server. It is used in PHP to create or modify information in a database, such as creating a user account or updating a product listing. A POST request is usually sent via an HTML form and the data is sent in the form of an HTTP body.
POST response codes: 200 (OK), 201 (Created), 204 (No Content).
PUT - used primarily to update an existing resource. If the resource does not exist, the API may decide to create new resource or not.
PUT response codes: 200 (OK), 201 (Created), 204 (No Content).
PATCH - is used to modify the values of the resource properties.
PATCH response codes: 200 (OK), 204 (No Content), 400 (Bad Request).
DELETE - used to delete resources (identified by the request-URI).
DELETE response codes: 200 (OK), 202 (Accepted), 204 (No Content).
What is JSON and how can it be used when communicating with a web API?
JSON stands for JavaScript Object Notation. JSON is a lightweight format for storing and transporting data. It is easy for humans to read and write. It is easy for machines to parse and generate. JSON documents consist of name/value pairs which reflect the structure of the data.
REST API and JSON allows us to separate frontend from backend. Backend (JSON) contains the data, while frontend displays the data. REST API send JSON instead of HTML.
What is the difference between Client and Server in web development?
A client is a user program that connects to a server to access a service. A web browser is a client program that makes use of web server facilities.
A server is a sample of software or hardware that serves a specific service to its clients. Web servers, domain name servers, and mail servers are some examples.
What is the URL structure of a request in a REST API?
Base URL - Enter base URL for the web service endpoint.
Resource path - Enter the path to the complete web service endpoint.
Query parameters - Enter a name and value for each query parameter to pass. Query parameters are appended to the endpoint after a “?” in the URL at runtime.
What are CRUD operations? Describe each CRUD-operation in as much detail as you can.
CRUD stands for Create, Read, Update, Delete. These are the CRUD operations.
Create - Save or create a new resource
Read - Display one or more resources
Update - Edit or update a resource
Delete - Remove a resource