5.12

Algorithm problem

  1. Stock problem expansion, need to output buy and sell time

Java

  1. How is heap sort implemented? How is the big top heap implemented?
  • A:
  1. What does Maven do
  • Maven is a project management tool that contains a project object model (POM: Project Object Model, a set of standards, a Project Lifecycle, a Dependency Management System, And the logic used to run the plug-in goal defined in the lifecycle phase. A core feature of Maven is dependency management
  1. What are annotations for
  2. When does an annotation not take effect? What is the nature of annotations?
  3. You know what the popular framework is right now? What is the difference between Spring MVC and SpringBoot?
  4. Several ways to create threads. Which one is more common? Why.
  • Methods are:
    1. Implement the Runnable interface, implement the run() method in the interface, use the Runnable instance to create a Thread instance, and then call the Start () method of the Thread instance to start the Thread.
    1. Implement the Callable interface. In contrast to Runnable, Callable can have a return value that is encapsulated by FutureTask

    1. Inherit the Thread class to implement the run() method.
  • Implementing the interface is better because:
    1. Java does not support multiple inheritance, so if you inherit Thread, you cannot inherit other classes, but you can implement multiple interfaces.
    1. It is convenient for the same object to be used by multiple threads
    1. The class might just need to be executable, and inheriting the entire Thread class would be too expensive.

MySQL

  1. How does mysql store data? Data structure?
  • The answer is still unclear. In fact, the database is used to store data persistently, essentially a database is a file system
  • Add: Database InnoDB engine, its data files themselves are index files. Compared with MyISAM, the index file and the data file are separated. The table data file itself is an index structure organized by B+Tree, and the data field of the leaf node of the Tree saves complete data records. The key of this index is the primary key of the table, so the InnoDB table data file itself is the primary index. This is called a clustered index (or clustered index), and the rest of the indexes are secondary indexes. The secondary index’s Data field stores the value of the primary key of the corresponding record rather than the address, which is also different from MyISAM. When searching according to the main index, data can be retrieved by directly finding the node where the key is located. When searching by secondary index, we need to fetch the primary key value first, and then walk through the primary index. Therefore, when designing tables, it is not recommended to use long fields as primary keys or non-monotonic fields as primary keys, as this can cause frequent splitting of primary indexes.
  1. What does an index do? Why index? Index data structure?
  • A: An index is a data structure used to quickly query and retrieve data. Index building can improve the efficiency of data retrieval and reduce the IO cost of database. Sorting data through indexed columns reduces the cost of sorting data and CPU consumption. The data structure is a B+ tree. See the previous item for details of storage.
  1. How to build an index:select * from user where a=1 order by update_time desc limit 100
  • A:CREATE INDEX idx_a_update_time ON tb_seller(a,update_time);The best candidate columns should be extracted from the conditions of the WHERE clause. Combined indexes can improve query efficiency
  1. What is SQL injection
  • A: It’s a database attack.

Meter network related

  1. What happens when the browser enters the url?

  1. How does the browser parse the returned resource?

– A: Reference link

1.Browsers use lexers and parsers to parse HTML content into a DOM Tree.2.CSS resources are parsed into CSS Rule trees.3, JS uses DOM API and CSSOM API to manipulate DOM and CSS trees.4After parsing, the Rendering Tree will be integrated into DOM Tree and CSS Tree to generate Rendering Tree and calculate the position of each element (Frame), which is called layout process.5, call the OPERATING system Native GUI API drawing.Copy the code
  1. What is static separation?
  • Refer to the link
  • Static pages refer to the pages in the Internet architecture that are almost unchanged (or change frequency is very low) : HTML pages such as the home page, style files such as JS/CSS, JPG/APK and other resource files. Static page access path is short, access speed is fast, a few milliseconds
  • Dynamic page refers to the Internet architecture, different users in different scenarios visit, will dynamically generate different pages, such as search results, personal order pages. Dynamic page access path is long, the access speed is relatively slow (database access, network transmission, business logic calculation), tens or even hundreds of milliseconds
  • Static and dynamic separation: static pages and dynamic pages adopt different architectural design methods

  1. Where are static resources stored?
  • A: Some say file system (disk), some say memory. What the interviewer means, it sounds like memory.
  1. What are the components of HTML?
  2. What are the cyber attacks?
  3. The difference between cookies and sessions.
    1. Session Stores the data of multiple requests for a session on the server. Cookie on the client
    1. Session has no data size limit, Cookie does
    1. Session data is secure, while cookies are insecure
  1. When do I use cookies and when do I use sessions
    1. A single request can use cookies, and multiple requests must use a session to store data
    1. Redirection must use session to store data
  1. DNS, TCP/IP specific workflow