The JAVA interview questions (including the answers) that were summed up after interviews with countless companies, get more than 80% of the technical aspects!

Preface

    Recently, many group friends in the technical exchange group sent all the interview questions to the group for discussion after the recent interview. It was still relatively hot and discussed the answers, but the interview questions were relatively scattered, so the bloggers The interview questions collected by the Lord are organized and shared with you!

There is a surprise at the end of the article!

algorithm

     It is recommended to prepare some common questions. The 8 sorting algorithms must be known, and then you can find the 20-30 questions that are frequently tested for the linked list and the tree to absorb them. There are also some DP, greedy, and permutation. Combining classic topics, there may not be much code for graphs, but the graph algorithm still needs to be mastered. If necessary, tell them about topology, Dijkstra, Prim and Kruskal.

data structure

     Data structures are nothing more than arrays, linked lists, stacks, queues, trees, and graphs. The most important thing is to understand their usage scenarios and differences. For example, for trees, search trees, balanced search trees, red-black trees, prefix trees, B, and B+.

computer network

  1. Let’s talk about the seven-layer model. What do all the layers do? What are the agreements?
  2. What is the difference between TCP and UDP, their respective components, application layer protocols based on TCP and UDP? Their respective application scenarios?
  3. TCP three-way handshake, four waved hands, why three-way handshake? Wave four times? , Is it OK to wave three times, what should I do if the client fails after connecting?
  4. How does TCP ensure a reliable, congestion control process?
  5. Scenarios for the causes of TCP sticking and unpacking and how to solve them?
  6. CLOSE-WAIT 和 TIME-WAIT ?
  7. Why are there too many TIME-WAIT connections? solve?
  8. What happens when the browser enters the URL and press Enter? DNS query process? When does DNS use TCP and when does UDP use? Does CDN know?
  9. What is the difference between HTTP 1.0, 1.1 and 2.0?
  10. HTTP message format? Commonly used fields? Strong caching and negotiation caching?
  11. The difference between HTTP and HTTPS? The establishment process of HTTPS? Symmetric encryption and asymmetric encryption?
  12. HTTP request method? What is the difference between GET and POST?
  13. Common status codes? What is the difference between 301 and 302? What is the difference between 502 and 504?
  14. What is the difference between cookie and session?
  15. Cross-domain? How to solve cross-domain?
  16. SYN flood attack? XSS script attack? csrf cross-site request forgery? The solution?
  17. ARP spoofing? DNS hijacking? Fool window? and many more. . .

operating system

     I personally think that the OS is relatively well prepared. The main considerations are process threads and virtual memory. Linux tests are more commonly used commands, and how to troubleshoot problems for you.

Examples of interview questions:

  1. What is the process? How many states of the process? What are stored from low address to high address?
  2. The difference between process and thread?
  3. What are the process communication methods and compare the advantages and disadvantages?
  4. User mode and kernel mode?
  5. What is the context? Process thread context switch?
  6. Process scheduling algorithm? Necessary conditions for deadlock? The solution?
  7. Paging and segmentation, page replacement algorithm?
  8. swap partition? fork function? Zombie process? Orphan process?
  9. CPU cache? Does MESI understand? Wait
  10. IO model? Multiplexing select, poll, epoll?

Java multithreading

  1. Thread communication method in Java
  2. Optimistic locking in Java? CAS problem? When to use optimistic locking?
  3. volatile keyword? How to prevent reordering? Low-level instructions?
  4. Sychronized vs. ReentrentLock?
  5. How to implement Sychronized bottom layer? What is MarkWord? Bias lock, lightweight lock, heavyweight lock? How to set the spin parameter?
  6. How does AQS work? How to implement fair lock and unfair lock?
  7. Read-write lock? Lock downgrade? What information is stored in the upper 16 bits and the lower 16 bits of the variable?
  8. CountDownLatch、CyclicBarrier、Semaphore?
  9. Thread Pool? 7 big parameters? Thread pool work process? Why is it not recommended to use the built-in thread pool? How should the number of cores be set?
  10. Write a producer consumer, block queue, multi-thread printing ABC in turn? Hold on

JVM

     First of all, I mainly grasp the memory division of JVM, what each part stores and do, the division of the heap, the principle of object allocation (the object is in the old or young generation, how to move it), garbage collection algorithm, and how to label objects (reference counting method) Disadvantages of the GCroots method, which objects can be used as roots), which parts of the object are composed of, garbage collector (that is, G1, CMS can mainly look at, and then you can look at the ZGC collector), parental delegation principle and destruction, The loading process of the class (you can start from the process of .java generating .class, JIT compiler) and so on.

Most of the more common problems are related to JVM tuning. How to say this is based on your own understanding and the difference in the project.

frame

     In the interview, I mainly look at the principles and understanding of each framework, such as Spring's IOC, AOP? How to solve the circular dependency? The life cycle of a bean? What is the startup process of SpringBoot? What are the parts of the RPC framework?

In the interview, there are still not many questions about the framework. The questions are all about the characteristics and principles. Some common questions are not big enough to spend time preparing.

database

  1. The difference between engines?
  2. Index (failure? Joint index? Index creation principle?)
  3. Lock (row lock? table lock? gap lock?)
  4. Transaction (isolation level, how does RR avoid non-repeatable read (MVCC)? How to avoid phantom read (MVCC + gap lock)?)
  5. B+ tree index and hash index, clustered index and non-clustered index?
  6. Back to table query and index coverage?
  7. What is the execution process of a SQL?
  8. How to optimize paging if the data is too large?
  9. What do the various logs do?
  10. How to troubleshoot if SQL is too slow? The key field of Explain?
  11. How to transform LUR in MySQL? Why did you change this? and many more.
  12. Master-slave replication? The sub-database and sub-table basis?

Redis

  1. Why is Redis fast?
  2. Redis persistence method?
  3. type of data? The underlying data structure?
  4. Expiration strategy and memory elimination strategy?
  5. Redis application scenarios?
  6. What are the advantages of pipeline batch processing?
  7. Principle of master-slave replication? Does cluster understand? How to determine which node a key falls on? Do you understand consistent hashing? What are the disadvantages? How to deal with it?
  8. Cache avalanche, cache penetration
  9. How to ensure the consistency of cache and database data? and many more.

Middleware

     Regarding middleware, the first thing to understand may be message queues. I use RabbitMq most often, but I also need to understand other product features and application scenarios, such as the comparison of Kafka and RocketMq. Frequently asked questions such as:

  1. What is the application scenario of message queue and its role?
  2. How to ensure that the message is reliable?
  3. How to ensure that consumers are idempotent?
  4. How to ensure the order of messages?
  5. What if there is a lot of backlog in MQ? Wait.

distributed

     Distributed-related knowledge still needs to be mastered. After all, the future system cannot be deployed at a single point. Can you look at the CAP theory? BASE theory? Distributed transaction? Current limiting plan? Distributed id generation strategy? Distributed lock? Or commonly used Hystrix components, etc. Most of the exams are still taken during the interview.

Big data type

You can look at a few more questions of this type. Most of the ideas are the same, so it is better to prepare, for example:

  1. Mass data integer, memory limitation to find the median?
  2. How to quickly determine whether a URL exists among 10 billion URLs?
  3. TOP100 search times for massive data? and many more.

to sum up

The interview is a protracted war, in this process, not only will you gain the satisfaction of the offer , exercise their skills and improve emotional intelligence , but also make friends from various places , the group has been fighting with your friends!

The edge of the sword comes from sharpening, and the fragrance of plum blossom comes from the bitter cold. I wish you all a satisfactory offer.

 The editor also sorted out the interview questions and answers: click here to get it for free, the code: CSDN , there are more interview topics and videos from major companies!

 It is not easy to write an article. If you think it is helpful, please like to follow and support the editor. You are also welcome to ask questions, thanks! ! !

 

Guess you like

Origin blog.csdn.net/qq_43080036/article/details/108996420