The most complete collection of Java interview clearance cheats in 2018 2

Note: This article is compiled from the interview experience of many interviewees, many of which are some of my own questions, and there are many Internet resources. Any similarity is purely coincidental! All forms of touching porcelain are prohibited! All forms of reprinting and copying are prohibited without permission, and legal responsibility will be pursued if there is any violation!

First of all, I know you well! When you read this article, you may be happy and sad! The good news is that others did not see these carefully organized interview questions. Sadly, the interviewer who interviewed you may have seen them too! A few days ago, I sorted out a lot of classic questions about interviews, such as why Redis is single-threaded, how SqlSessionTemplate guarantees the thread safety of SqlSession, cache avalanche, cache penetration, Hash consistency, etc. Many small partners left messages It means that the interviewer did ask a certain question, but did not read this article carefully, resulting in a poor answer!

Therefore, seeing this, I hope that every small partner will not simply throw this article into their favorites, for your promotion and salary increase, please treat every topic well! Each question may become a stumbling block for you in the future!

Don't ask me why I don't have an answer anymore. The reason is the same as the previous sentence. No problem can be solved by the test questions on the back. Only by going deep into its internal principles can you be at ease! A series of later articles will continue to explore these classic interview questions, so stay tuned! Also welcome everyone to add and discuss in the message area!

Java related

What is the default space of Arraylist and LinkedList;

The difference between Arraylist and LinkedList and their respective advantages The difference between List and Map;

Talk about HashMap, the method of hash table to resolve hash conflicts;

Why rewrite hashcode() and equals() and the difference and relationship between them;

How is Object's hashcode() calculated?

What will happen if the hashcode method always returns 1 or a constant?

What is the default sort method of the sort method of Java Collections and Arrays;

The difference between reference counting method and GC Root reachability analysis method;

The difference between shallow copy and deep copy;

String s=”abc” and String s=new String(“abc”) difference;

Where does the hashcode in the HashSet method exist? What happens if you override equals without rewriting the hashcode?

The role and realization principle of reflection;

The callback mechanism in Java;

Template method mode;

Talk about the principle of opening and closing;

Publish/subscribe usage scenarios;

KMP algorithm (an improved string matching algorithm);

How are atomicity, visibility, and order in JMM reflected? What does the memory barrier in JMM mean?

Two, multithreading

The underlying implementation principle of AtomicInteger;

Synchronized or ReentraLock which is a fair lock;

What will happen to the CAS mechanism;

Which classes under the concurrent package have been used;

What happens if a thread calls start twice in succession?

Can the wait method be rewritten, and can wait be interrupted;

Implementation of thread pool? Four thread pools? Important parameters and principles? What are the task rejection strategies?

This transition occurs in thread state and how the API operates;

Commonly used methods to avoid deadlock;

Three, JVM

When do Minor GC and Full GC happen respectively? When to trigger Full GC;

What are the GC collectors? Features of CMS collector and G1 collector.

When will Java leak memory;

How to store large objects in Java;

What class loader loaded rt.jar and when was it loaded;

What is loaded and when the class written by myself is loaded;

Are two different classes written by yourself loaded by the same class loader? why?

Why does the new generation memory need to have two Survivor areas?

Several commonly used memory debugging tools: jmap, jstack, jconsole;

The five processes of class loading: loading, verification, preparation, analysis, and initialization;

Does G1 pause, CMS recovery step, why CMS pause, pause time;

What is the main data stored in the stack, and the heap?

How many parts of the heap are divided into, for example, the Cenozoic and the Old Generation, then what is the Cenozoic Generation?

Use scenarios of soft references and weak references (soft references can implement caching, and weak references can be used to prevent memory leaks in callback functions);

Fourth, the database

Database index, what is full-text index, what is the principle of inverted index in full-text index;

What is the best left-prefix principle for databases?

Three paradigms of database;

The principles and application scenarios of pessimistic locking and optimistic locking;

Left connection, right connection, inner connection, outer connection, cross connection, Cartesian product, etc.;

Under normal circumstances, how to recover from database downtime (what is the Write Ahead Log mechanism, what is the Double Write mechanism, and what is Check Point);

What is redo log and undo log;

How to achieve isolation in the database; how to achieve atomicity, consistency, and durability;

What is a composite index, and when will the composite index fail;

The difference between relational database and non-relational database;

How to solve the database deadlock;

How to solve MySQL concurrency (through transaction, isolation level, lock);

What is the meaning of the MVCC mechanism in MySQL? According to specific scenarios, whether there is a problem with MVCC;

The isolation level of MySQL database, and how to solve phantom reading;

Five, cache server

ZSet jump table problem in Redis;

Where is the application of Redis set?

Do you understand the advanced features of Redis?

What is the use of Redis pipeline?

How to deal with Redis cluster downtime and how to migrate data;

Redis cluster solution;

How to use Redis atomic operations is better;

How is the Redis expiration strategy implemented?

Six, SSM related

What is the difference between @Autowired and @Resource annotations in Spring?

Spring declares how to personalize a bean;

What are the advantages of MyBatis;

How does MyBatis do transaction management;

Seven, operating system

Linux static link and dynamic link;

What is the IO multiplexing model (select, poll, epoll);

What is the use of grep pipeline in Linux? Common commands for Linux?

The concepts and differences of virtual address, logical address, linear address, and physical address in the operating system;

Memory page replacement algorithm;

Memory page replacement algorithm;

Process scheduling algorithm, how does the operating system schedule processes;

Concepts of father-son process, orphan process, zombie process, etc.;

Operations during fork process;

Kill usage, the reason why a certain process cannot be killed (a dead process; enter the kernel mode, ignore the kill signal);

System management commands (such as viewing memory usage, network conditions);

find command, awk use;

Troubleshoot an infinite loop thread under Linux;

8. Network related

What does the data link layer do?

Flow control at the data link layer?

The layering of the network model, where the IP and Mac addresses are at, and the layer where TCP and HTTP are respectively;

TCP sliding window;

Why is TCP reliable;

What does TCP simultaneous interpretation, unpacking and assembling packages mean;

What is the difference between Https and Http;

Why is Http stateless;

TCP three-way handshake, why not three times, why not four times;

Detailed description of TCP congestion control and flow control?

The difference between Http1.0 and Http2.0;

How to communicate between two computers with different ip addresses;

Address Resolution Protocol ARP;

Which part of the five-layer model of the OSI seven-layer model corresponds to each;

What if the TCP three-way handshake data is lost? What if you find it again later?

Nine, distributed related

Introduction and function of the scene used by the message queue (application coupling, asynchronous messaging, traffic cutting, etc.);

How to solve the problem of message loss and repeated consumption in the message queue;

Has Kafka been used, and what is idempotence? How to ensure consistency, how to do persistence, the understanding of partition partitions, what LEO means, how to ensure data consistency between multiple partitions (ISR mechanism), and why Kafka can be so fast (disk-based sequential read and write);

How to implement asynchronous queues;

What is the concurrency of your project? How to solve the problem of high concurrency? What is the concurrency of Tomcat in a stand-alone case and what is the concurrency of MySQL?

What is the C10K problem;

What to do in the case of high concurrency;

Distributed theory, what is CAP theory, what is Base theory, and what is Paxos theory;

Election algorithm of distributed protocol;

Talk about the difference between your understanding of microservices and SOA;

The basic principle of Dubbo, RPC, which communication methods are supported, and the calling process of the service;

What if one of Dubbo's services goes down;

Distributed transactions, how to ensure consistency when operating two tables in different databases.

In a distributed system, how does each machine generate a unique random value;

System magnitude, pv, uv, etc.;

What is Hash consensus algorithm? The consistency of the distributed cache, how to expand the server (hash ring);

Forward proxy, reverse proxy;

What is a client-side load balancing strategy and what is a server-side load balancing strategy;

How to optimize Tomcat and what are the common optimization methods;

Nginx Master and Worker, how does Nginx process requests;

10. System design related

How to prevent duplicate submission of forms (Token token ring etc.);

There is a url whitelist, which needs to be filtered by regular expressions, but the magnitude of the url is very large, about 100 million, so how to optimize the regular expression? How to optimize hundreds of millions of URL matching?

Common Nginx load balancing strategy; there are already two Nginx servers, if another server is added at this time, what load balancing algorithm is better?

Analysis of the process of scanning the QR code to log in;

How to design an algorithm to generate unique UUID?

Realize a load balancing algorithm, server resource allocation is 70%, 20%, 10%;

There are three threads T1 T2 T3, how to ensure that they are executed in order;

Three threads loop to output ABCABCABC....

11. Security related

What is XSS attack and what are the general manifestations of XSS attack? How to prevent XSS attacks;

Guess you like

Origin blog.csdn.net/yipianfeng_ye/article/details/82386889