After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

one side

1. Self-introduction

A: Self-introduction is the only link to introduce yourself actively in the interview. You must grasp it well. You can tear a red and black tree by hand if you have a good data structure. You say that I have a good data structure. My advantages are highlighted. For example, I am familiar with java knowledge. After I introduced my undergraduate experience, I said that I was sent to my school to continue my graduate studies, and then I will add my familiar java at the end, and then the interviewer will Will ask some things about java;

2. Project introduction and highlights

Answer: Blow hard ...

3. What are the 8 data types of java?

Answer: It feels like this question has been rotten, int, short, long, float, double, byte, boolean, char;

4. Asked the range of Integer cache data?

Answer: -128-127

5. Immediately asked what methods the Object class has?

Answer: I have recite this, clone, getClass, toString, finalize, equals, hashCode, wait, notify, notifyALL. (I do n’t know what it means to interview)

6. Asked here and came up with a question. The interviewer had a small note with the title on it, String A = "123"; String B = new String ("123"); and asked me how many String objects were generated ?

Answer: I said that if there is no "123" in the constant pool, then 2 objects are generated. If there is "123" in the constant pool, only 1 object is generated (interviewer don't fucking ask this question)

7. Since wait is mentioned, by the way, what is the difference between wait and sleep?

Answer: If you wait, the object lock will be released. If you sleep, the object lock will not be released.

8. Since the hashcode is also mentioned, the interviewer then asked me, where is the hashcode used?

Answer: I thought about this without thinking, hashmap and ConcurrentMap, here I guess the interviewer must continue to ask me these two things.

9. Sure enough, the interviewer said, talk about hashmap?

Answer: I have talked about the hashmap data structure array linked list structure of hashmap, the put, get of hashmap, the underlying principle of expansion, and the difference between hashmap in 1.7 and 1.8. The red and black trees are introduced in put and the expansion Different times, these have been talked about for a long time, and finally I said that hashmap is not thread safe.

10. It is mentioned here that hashMap is not thread-safe. The interview asked me why it is not thread-safe. Here are a few examples?

Answer: I said that during expansion, the hashmap may generate a loop, causing an endless loop. When the hashmap is inserted into a new stage, multiple threads are inserted at the same time, and the nodes inserted by other threads except the last one will be lost. ; For modification, multiple threads modify, only the modification result of the last thread is reserved; when expanding, only the array after the expansion of the last thread will be retained; from the expansion modification, it is said again;

11. I thought I would continue to ask ConCurrentMap, which is beyond my expectations. I didn't ask. I might think that my hashmap was well prepared. Then I asked me about JVM.

Answer: I said understand;

12. Let me tell you which blocks the JVM is divided into?

Answer: Method area, virtual machine stack, local method stack, heap, program counter, and then I did n’t wait for the interviewer to ask new questions. Continue to say that the method area and heap are shared by the thread, and the local method stack of the virtual machine stack And the program counter is private to the thread. Except for the program technician, no memory overflow will occur, and other memory overflows will occur, and it will say which heap overflows will occur and which stack overflows will occur; here is what everyone should learn by themselves. A bunch, because according to my observation that each interviewer has a fixed time for each interview, it will end after this time period, so as long as the interviewer does not interrupt you, you will say it;

13. Due to the mention of memory overflow, the interviewer asked me the difference between memory overflow and memory leak?

A: Memory leak. I said that after applying for a piece of memory, I cannot release this piece of memory and lost the reference to this piece of memory. A memory overflow means that the requested memory is not enough to support the memory we need;

14. After asking here, I asked the database, what are the four major features, for example?

Answer: Atomic, I mean that a transaction must be completed or failed, or it must be done or not; consistency, such as a + b = 100, a transaction changes a, such as increasing the value of a, then it must be changed at the same time b, to ensure that a + b = 100 is still established after the end of the transaction, which is consistency; durability, the amount is permanent after the modification is effective in the database; isolation, I mean for A to B transfer When A did not complete the transaction, B did not know that A was going to transfer money to him.

15. What are the isolation levels of the data, and each isolation level is an example?

Answer: Ah, (how to give examples, ah ah ah ~), the inner waves, expressionless expression on the face: 1. Uncommitted reading, the transaction has been modified, even if not submitted, other transactions are also visible For example, I said that for a number A, the original 50 was changed to 100, but I have not submitted the modification. Another transaction saw this modification, and this time the original transaction was rolled back. At this time, A is still 50, but the other The A seen by the transaction is 100, which is the uncommitted read; 2. Committed read, that is, any modification made to a transaction from the beginning until before it is committed is invisible to other transactions, for example, for a number A It is 50, and then commit to modify it to 100. At this time, another transaction reads A before it submits the modification, and A reads 50. After reading it, A is modified to 100. At this time, another transaction reads and finds A suddenly becomes 100; 3. Repeatable read; repeatable read, that is, the record read multiple times for a record is the same, for example, if a number A is read, it will always be A, read twice before and after Arrived A is consistent; serializable reading, that is to say, in the case of concurrency, the result of serialized reading is the same, there is no difference, this example I said, dirty reading and magic reading will not occur; Then the database piece passed.

16. Then I asked me about the computer network and asked me which 7 floors are there?

Answer: Physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer;

17. Then asked me which layer is TCP, which layer is UDP, and which layer is HTTP?

A: TPC and UDP are at the transport layer, and HTTP asks me which layer I am at. I forgot a bit. I did n’t answer this, so I will go to the application layer.

18. When asked here, it is over, then the interviewer asks me what I want to ask, and I ask how to evaluate my interview performance?

Answer: The interviewer told me because I was asking for basic knowledge. I feel that you have a solid foundation. He told me directly that my words here were passed. I do n’t know how the interviewer asked you later. Then I said Thank you, just go to a conference hall in the hotel and wait for two sides;

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Two sides

Not long after one side, I immediately notified the two sides. I felt a little hungry halfway. The Meituan was quite human. I put a bunch of cookies on the table at the back. I forgot the name of the cookie. I ate several pieces.

1. Self-introduction

2. Introduction to the project and its highlights.

Then asked me to understand the collection, let me talk about the difference between ArrayList and LinkedList?

Answer: The bottom of ArrayList is an array, the bottom of LinkedList is a linked list, ArrayLIst finds data quickly, and LinkedList inserts and deletes quickly;

3. Continue to ask me whether linkedList can be traversed with a for loop?

Answer: Can you not use it as much as possible? The bottom of the linkedList is a linked list. It uses for for traversal. Every element is accessed from the beginning and then until the element is found. For example, to find the third node, you need to find the first node and then Find the second node; continue to find the fourth node, not from the third node, or from the first node, so it is very slow, it is not recommended, you can use the iterator to traverse.

4. Introduce ConCurrenthashmap

A: I think it ’s because I asked the hashmap on one side, so the interviewer may have seen the interview record, um, I ’m very familiar with this one, I talked about it for a long time, and talked about the bottom segment lock of ConCurrentHashMap Structure, I talked about the Get source code of ConCurrentHashmap, and the get source code does not use locks. Here I wrote down the get source code and told the interviewer that the get source code is safe under the multithreading of insertion, modification and deletion; Put operation, remove, expansion operation, and then talk about the difference between 1.7 and 1.8, the introduction of red and black trees, the length of the linked list is greater than 8 converted into red and black trees, using CAS + synchronized to ensure concurrency security, let's talk It's been a long time

5. Let's take a look at this question and say to take out a small note

Answer: This note feels that each interviewer is only a note, so communicate with the students around you as much as possible. There is a certain chance that his interviewer will be your interviewer. Title: Let me calculate the values ​​of a, b, c, d by myself,

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

The results are

a=8, b=5,c=7,d=35

After the calculation, I asked him if he was right, he didn't suppress me. . .

6. Then ask me if the simple interest model understands, write a single case model?

Answer: I have prepared this before, and I wrote a single-case model of double lock.

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

It is recommended not to write this singleton pattern, or to write out all of them directly

7. Then I asked my virtual machine to understand, introduce some memory models of virtual machines?

Answer: I have also prepared this before. It should be noted here that the memory model of the virtual machine is not the same as the data area at runtime; the memory model of the virtual machine is also called JMM, that is, each thread has its own working memory, and then another Main memory, when the thread is working, it copies a copy of the main memory in its own working memory; it also talks about the JMM's happens before principle, program sequence principle, lock principle, thread interruption principle, transitivity principle, and other I didn't think about it without thinking about it.

8. Introduce some garbage collection algorithms you know?

Answer: Mark clearing, mark sorting, copying algorithms, say what each algorithm is;

9. Asked here, asked me, do you know why the SurvivorRatio parameter is initially 8: 1: 1 by default?

Answer: Since I just asked the garbage collection algorithm just now, I think it may be related, so I said that it is convenient to copy the operation of the algorithm, most of the Eden area is dead, this ratio can facilitate the copy algorithm from and to The objects that have been copied to survive back and forth, uh, after that, he didn't say anything, it feels like acquiescence;

10. Suddenly asked again, do binary trees understand, write a deep search traversal of binary trees?

Answer: I heard the middle question at that time, and it was a bit confusing. What is the deep search traversal of the binary tree, I only know the hierarchical traversal, pre-order and post-order traversal. I think it should be post-order traversal, I first wrote a recursive way of post-order traversal

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Then he glanced at it and said nothing. The interviewer felt a little cold and did not interact with me during the whole process, emmmm .... came down to Baidu, right. . .

After this code asked me, let me wait for the notification, and I felt that the answer was okay. Sure enough, within a few minutes, I was notified to go to three sides.

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Three sides

1. Self-introduction and project introduction as usual;

2. Let me tear up a single case by hand. . .

Answer: Continue to write about my dual lock mode

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

3. Let me talk about what the code means?

answer:

STEP 1. Thread A accesses the getInstance method, because the singleton has not been instantiated, so it enters the lock block.

STEP 2. Thread B accesses the getInstance method, because the singleton has not yet been instantiated and has access to the next code block, which has been locked by thread 1.

STEP 3. Thread A enters the next judgment. Because the singleton has not yet been instantiated, the singleton is instantiated. After the successful instantiation, the code block is exited and the lock is released.

STEP 4. Thread B enters the next code block, locks the thread, and enters the next judgment, because it has been instantiated, exits the code block, and unlocks.

STEP 5. Thread A initializes and obtains the singleton instance and returns, and thread B obtains the singleton initialized in thread A. This is basically the case.

5. Since the JVM is mentioned in my project, I have a scene question. In the garbage collector, after the mark is cleared many times, because the mark removal algorithm is used, what do you think may be the problem?

Answer: Then I said that due to memory fragmentation, when allocating a large object, because the memory is not continuous, then full GC will be generated;

6. Full gc is mentioned here, ask me, in which cases will full GC be generated, and in which cases will minor GC be generated?

Answer: minor will be generated when the eden area is full, fullGC will generate insufficient remaining space in the old generation, and full generation memory will also be insufficient.

7. In addition to the memory overflow problem in your project, what else do you know about memory leaks and memory leaks?

Answer: I have learned about ThreadLocal before. I said that the key in the key-value pair in ThreadLocal is a weak reference. Then when the memory is recycled, this key is likely to be recycled. Then the key is gone, and the value cannot be found. , Causing a memory leak;

8. Then gave me a handwritten code question for dynamic programming. Let's write a code. Generally, it is in n * m matrix squares. Finding the largest square is multiplying and multiplying.

A: Since I have not prepared the topic of dynamic planning, I saw that I only talked about the solution of violence in this topic. Then the interviewer reminded me to use dynamic planning. I did n’t think about it for a long time. . . . It felt like it was cold. . .

When the time was about the same, the interviewer said, just come here, and then let me go out to wait for the notice. Sure enough, I was informed that the interview was over today. The whole afternoon was particularly tired. I felt very stable at the end of the first two sides. Because the piece of hand-written code will not hang up in dynamic programming, I felt a bit of a mentality collapse. . .

Recently, I have compiled an interview document with a thorough explanation. Share it with everyone today. The document includes 14 chapters from the basics to the project, and the explanation is in-depth and thorough. I hope you will get your favorite offer.

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

The following editors give you some interview answers:

Microservices

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Java multi-threaded concurrency

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Spring principle

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

database

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

cloud computing

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

RabbitMQ

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

Document acquisition method: you can help forward + follow the private message reply "learn" to get it! ! !

Due to space limitation, only part of the content is shown for everyone. The following is the directory of documents. I wish that the program ape who will be interviewing can get his favorite offer.

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

After nibbling this 283-page PDF organized by Ali Daniel, easily get the offer from the favorite first-line manufacturer

 

Published 100 original articles · won 10 · 30,000+ views

Guess you like

Origin blog.csdn.net/Ppikaqiu/article/details/105141580