Example Questions Flashcards

1
Q

What is a multi tier architecture project structure?

A

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.

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

What are the benefits and drawbacks of a multi tier architecture project structure?

A

Advantages:
- Scalable
- Increased security
- Reusable
Disadvantages:
- Increased effort
- Increased complexity

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

Describe the purpose of the different files and folders in a multi tier architecture web project.

A

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.

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

What is the distinction and difference between backend and frontend programming?

A

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.

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

Explain HTTP in as much detail as you can.

A

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.

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

What is the request-response cycle in HTTP?

A

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.

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

Describe the purpose of status codes in HTTP, what types of codes there are and when to use each one.

A

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

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

Name some common status codes and what they mean.

A

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.

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

What is a REST API? Describe all parts of REST APIs in as much detail as you can.

A

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.

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

Describe all parts of REST APIs in as much detail as you can.

A

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.

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

List the various HTTP-Methods (GET, POST, PUT, PATCH, and DELETE) and describe the purpose and uses of each one.

A

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).

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

What is JSON and how can it be used when communicating with a web API?

A

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.

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

What is the difference between Client and Server in web development?

A

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.

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

What is the URL structure of a request in a REST API?

A

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.

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

What are CRUD operations? Describe each CRUD-operation in as much detail as you can.

A

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

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

Explain the purpose of PHP, Apache, and MySQL when developing web applications.

A

PHP is a server-side scripting language embedded in HTML in its simplest form. PHP allows web developers to create dynamic content and interact with databases. PHP is known for its simplicity, speed, and flexibility.
PHP = programming language.
As a Web server, Apache is responsible for accepting directory (HTTP) requests from Internet users and sending them their desired information in the form of files and Web pages.
Apache = web server.
MySQL determines the speed of when things load on your site and how fast you can access that stored data. It has a direct impact on site performance, which makes it an integral part of web design.
MySQL = database.

17
Q

Write MySQL code for creating a table of users with a username and email, inserting two rows, and selecting the row with the id 1.

A

Create new table
CREATE TABLE ‘users-db’.’users’(
‘id’ INT NOT NULL AUTO_INCREMENT ,
‘username’ TEXT NOT NULL ,
‘email’ TEXT NOT NULL ,
PIMARY KEY (‘id’)
);
Insert new row
INSERT INTO users (username, email)
VALUES (anna, anna.skog@mail.com);
Select row with id 1
SELECT *FROM users WHERE id = 1;

18
Q

Describe relational databases in as much detail as you can, include the terms “table”, “primary key”, “foreign key”, and “Relations”.

A

A relational database organizes data into rows and columns, which collectively form a table. Data is typically structured across multiple tables, which can be joined together via a primary key or a foreign key. These unique identifiers demonstrate the different relationships which exist between tables, and these relationships are usually illustrated through different types of data models.
Primary key - The identifier for each row (often id).
Foreign key - Data in one table that references
a primary key in another table.