36 posts

15 / 36
·Tech·CS

Back-end developer interview preparation questions - Web

Full page →
CS

Web

How the Internet works

  • The Internet is network infrastructure, and the web is service that operates on the Internet.
  • Other services that operate on the Internet include email, file sharing services, streaming services, cloud computing services, and online game services.
  • In addition to the web, emails can also be sent through software, such as SMTP, POP3, etc.
  • Computer - Router - ISP - ISP - Router - Computer
  • Your Internet Service Provider (ISP) manages the router you connect to and provides access to other ISP routers.
  • Specify a specific computer to receive messages via IP address or domain name

How the web works

  • A client is a web user's Internet-connected device, and a server is a computer that stores websites, apps, etc.
  • Browser address input - DNS server - HTTP request to IP address server (sent via TCP/IP connection) - Response and data packet, which is the website file, are sent to the browser - The browser assembles and displays the website

HTTP (HyperText Transfer Protocol)

  • Protocol used to transmit web data
  • HTTPS (secure version of HTTP) uses SSL/TLS protocols to encrypt data transmission and provide security.
  • SSL (secure sockets layer) and TLS (transport layer security) are encryption protocols designed to securely transmit data over networks. SSL was originally developed by Netscape, and TLS was later developed by the Internet Engineering Task Force (IETF) as a standardized version of SSL.

What is Restful API?

  • HTTP-based web service architectural style, web API design principles for representing resources and conveying status
  • Consistency of client-server communication
  • GET, POST, PUT, DELETE
  • HTTP method type by which the client requests or transmits information to the server
  • GET is mainly used to retrieve information from the server and does not change the state of the server.
  • POST is used to submit or save data to the server, and can change the state of the server.
// Create User (POST request)
POST /users
Content-Type: application/json
{
"name": "John Doe",
"email": "john.doe@example.com"
}
// response
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
// User query (GET request)
GET /users/1
// response
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}

gRPC(google remote procedure cell)

  • Open source RPC framework developed by Google
  • The difference is that it uses HTTP/2 and passes data to protocol buffer
  • Protocol buffers serialize data using a binary data format. This provides smaller message sizes and higher serialization and deserialization speeds.
  • HTTP/1.1 is the most widely used version, HTTP/2 provides performance improvements, and HTTP/3 uses the new transport protocol QUIC to provide better performance and security.
  • Restful API adopts a resource-centric API design, while gRPC adopts a service-centric API design
  • A resource is an object of data or something that can be manipulated by a service. For example, resources can be users, products, orders, etc.
  • Centers on calling the methods of the service, and each method performs a specific task and returns a result.
syntax = "proto3";
service UserService {
rpc CreateUser(CreateUserRequest) returns (User);
rpc GetUser(GetUserRequest) returns (User);
}
message CreateUserRequest {
string name = 1;
string email = 2;
}
message GetUserRequest {
int32 id = 1;
}
message User {
int32 id = 1;
string name = 2;
string email = 3;
}

Differences between Web Server and WAS

  • Web server (Apache, niginx, iis) processes content such as static web pages, images, and CSS
  • The WAS web application server is responsible for creating and processing dynamic content, accessing databases, and executing business logic.

Differences and pros and cons between XML and JSON

  • Both formats for structuring and transmitting data
  • XML (eXtensible Markup Language) has a tag-based structure and expresses data with user-defined tags, making parsing complicated and slow. However, it is highly extensible using custom tags and is supported on many systems and languages.
  • JSON (JavaScript Object Notation) is a lightweight data format for exchanging or storing data, making parsing fast and efficient.

Differences and uses of node, element, and attribute in XML

  • The entire document is one node, and element represents each tag as one of the nodes.
  • Attribute is an attribute node in a tag that provides additional information within the element and is displayed as a name and value pair within the starting tag.
<!-- This entire document is a Node -->
<bookstore> <!-- 'bookstore' is an Element Node -->
<book category="fiction"> <!-- 'book' is an Element Node, 'category' is an Attribute Node -->
<title lang="en">The Great Gatsby</title> <!-- 'title' is an Element Node, 'lang' is an Attribute Node -->
<author>F. Scott Fitzgerald</author> <!-- 'author' is an Element Node -->
<year>1925</year> <!-- 'year' is an Element Node -->
<price>10.99</price> <!-- 'price' is an Element Node -->
</book>
</bookstore>

Uses of {} and [] in JSON

  • Braces indicate a JSON object and square brackets indicate a JSON array.
  • Braces consist of a collection of key-value pairs

Comments

No comments yet. Be the first!