Easy work products · Java practice · one-sided experience

This time, we bring you a face Sutra shared by a friend of Niuke nicknamed hel mal. Gou Yu makes an analysis and answer here. Let's have a look~

One side is very basic

1. Network counting

What is the difference between TCP and UDP? Which layer is used

Difference between TCP and UDP TCP should be connected, UDP should not be used; tcp one to one, udp one to many, many to many; tcp guarantees reliability, udp does not guarantee; tcp congestion control, flow control, udp does not. tcp and udp are in the transport layer.

osi seven layer model

Refer to my article [computer network] summary of interview questions

What protocol applies the TCP protocol

HTTP protocol: Hypertext Transfer Protocol, used for ordinary browsing HTTPS protocol: Secure Hypertext Transfer Protocol, HTTP protocol in SSL FTP protocol: file transfer protocol, used for file transfer POP3 protocol: post office protocol, used for receiving mail SMTP protocol: Simple Mail Transfer Protocol, used to send e-mail Telent protocol: remote login protocol, which logs in to the network through a terminal SSH protocol: Security Shell Protocol, which is used to encrypt secure login and replace Telent protocol with poor security

2. Data structure

What are the common data structures

Array, stack, queue, linked list, tree, hash table, heap, graph

What tree structures do you know

Search binary tree, B tree, B + tree, etc

Give you the number of nodes of the tree and find the number of layers of the tree. The tree is a complete tree

Complete binary tree: set the depth of the binary tree as h, the number of nodes in other layers (1 ~ h-1) reaches the maximum except layer h, and all nodes in layer h are continuously concentrated on the left. In a complete binary tree, the depth (number of layers) of a complete binary tree with n nodes is (log2n)+1, where (log2n)+1 is rounded down.

3. Operating system

What does the operating system consist of

Process management, storage management, device management, file management, program interface, user interface

4. JAVA collection

What categories does the collection include

For collections, refer to Collection of Java foundations

Implementation of Queue

There are three ways to implement a queue: (1) implement a queue through an array; (2) implement a pair of columns through a collection; (3) implement a queue through two stacks.

LinkedList is essentially different from ArrayList, (hint: memory)

Same reference Collection of Java foundations In short, it is based on linked list and array respectively

5,JVM

What kind of garbage collector do you have

The difference between replication algorithm and label collation

Refer to both: Eight part essay [JVM garbage collection]

6,mysql

  1. What index is there

Federated index, clustered index, overlay index, and so on

  1. How to connect to the database jdbc without using the framework
 public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
        ResultSet resultSet = null;
        try {
            //1. Load drive
            Class.forName("com.mysql.jdbc.Driver");
            //2. Get connection
            String url ="jdbc:mysql://127.0.0.1:3306/mybatis-01";
            String username = "root";
            String paaaword = "821365";
            connection = DriverManager.getConnection(url, username, paaaword);
            //3. Obtain statement and preparedStatement
            String sql = "SELECT * FROM tb_user WHERE id = ?";
            preparedStatement = connection.prepareStatement(sql);
            //4. Set parameters. The first parameter here represents id =, and the second parameter represents the value of ID. if there are two query criteria, the second parameterIndex will write 2
            preparedStatement.setLong(1,2);
            //5. Execute the query to obtain the result set
            resultSet = preparedStatement.executeQuery();
            //6. Processing result set
            while (resultSet.next()){
                //Parameters can write subscripts or column names (fields in the table)
                System.out.println( resultSet.getString("name"));
                System.out.println(resultSet.getString("user_name"));
                System.out.println(resultSet.getInt("age"));
 
               //The error is reported because there is no such field in the table. This is the attribute resultset in the class getString("username");
            }
        }  finally {
            //7. Close the connection and release resources
            resultSet.close();
            preparedStatement.close();
            connection.close();
        }

7. Frame

What annotations have you used

reference resources The most complete annotation of SpringBoot

Spring operating mechanism?

Just answer from the perspective of IOC and AOP. IOC is dependency injection, which is used to generate objects. Abstraction is separated from implementation to facilitate maintenance. AOP is the section, which can be regarded as an interceptor. Pluggable services.

8,Nginx

Common configuration

There are a lot of these. Baidu HA can choose several common configuration items, such as reverse proxy and gzip compression.

9,linux

1. Common commands

ps, ls, pwd, cat, kill, top, find, grep just pick a few common introductions, and you'd better bring parameters

2. How to find the running java program and its port number

ps -aux | grep java get pid Then netstat -nap | grep pid can be used

Added by pbsperry on Tue, 21 Dec 2021 02:14:46 +0200