Byte half a day*3 face/5 days to get the offer, all rely on your own hard power and this Java interview notes

Let me talk about the general situation first. It was an appointment at two o'clock in the afternoon. I didn't expect to have a one-time interview at six o'clock. . .

Interview Department: Beijing's infrastructure, back-end development

one side:

  1. Talk about hash table

  2. What should I do if the hash conflicts? (zipper) Is there anything else besides the zipper? (Open address method, I don’t know it very well, I have heard of it)

  3. What are the disadvantages of using hash for distributed storage? (Scalability is not strong, such as adding nodes and node downtime)

  4. How to solve? (Consistency hash, mentioned the hash slot of redis) Let’s talk about it

  5. What's wrong with consistent hashing? (data skew problem) how to solve it? (virtual node)

  6. Introduction to JVM (five parts)

  7. When will GC happen? (Answer the GC process) What is the difference between the MajorGC and fullGC you mentioned?

  8. Will FullGC have any problems? (STW) When will STW (introduce the general process of CMS, when marking)

  9. The difference between TCP and UDP

  10. What is 2MSL? Why wait for 2MSL? (Supplementary instructions on how to process received messages while waiting)

  11. Do you know when TCP sends rset packets? (have no idea)

  12. Introduce hashMap

  13. Is hashMap thread safe? (Not) how to ensure thread safety? (Answer concurrentHashMap) Let you implement it yourself? (Using sy to lock) How to lock (lock the put and get methods) to be more specific (sy is divided into class locks and object locks) Then what kind of lock do you think should be added (object lock, explain)

  14. ConcurrtenHashMap introduce (actively said)

  15. Talk about CAS

  16. The difference between sy and lock

  17. In what scenarios should CAS, sy, and lock be used? (This answer is not very good. I said it depends on the business needs. The three biases have different characteristics. Let me briefly introduce the different tendencies of the three.)

  18. What does memory leak mean? When does a memory leak occur? (Static constants are not used, threadLocal) Is there any more? (have no idea)

  19. Algorithm question:

1) Enter a cd command: /hist/add/camera/../int/has/../init to output the final file directory

2) Now there are one million scheduled tasks, which is a binary group <key, value>, key represents the trigger time, and value represents the task. Insert these one million timed tasks into a scheduling system, and design the storage structure of this scheduling system to ensure two points: the insertion speed is fast, and at the same time, the scheduling system can achieve second-level task scheduling

Two sides:

I don't remember very clearly, part is missing

  1. The memory in the jvm does not need to be allocated by itself, unlike C++ that requires malloc and free, do you know how the disk is managed under the window? (have no idea)

  2. Do you know how to quickly calculate the current capacity on the disk? (You can design a variable to increase the size every time it is stored, and then reduce it when it is released.) You may not know much about this aspect. There will also be memory fragmentation) there will definitely be, this is why the memory fragmentation will be cleared regularly under the window, you can go to find out about xxx (hmm)

  3. Do you know how a linux code file is loaded to run on the cpu? (I don’t understand, I said I can talk about how the java code is loaded and run) Then tell me

  4. Do you understand the protocol model? (TCP has four layers, OIS has seven layers, let me introduce the five layers. I will directly talk about the process of inputting url to the display interface, and explain the recursive query and iterative query of DNS in detail)

  5. A domain name may support multiple services, what should I do? (http1.1 supports host domain)

  6. So in the case of high concurrency, how do which servers ensure the efficiency of dns resolution (caching)? Is there anything else? (Distributed cache) The interviewer smiled (I explained, either it is solved from the code, or it is solved from the number of machines)

  7. The difference between TCP and UDP

  8. What protocol does DNS use?

  9. Do you understand the Ping command? What message is sent? (I said that I only know that the ICMP protocol is used, but I don't know the specifics)

  10. Do you understand the IO model? (BIO, NIO, AIO)

  11. A process of data from the network card to the disk

  12. The difference between process and thread (referring to coroutine) why coroutine switching is faster than thread (not involving privilege mode switching) why coroutine is not involved (should be generally only use coroutine to do user mode things, I am not very good at go learn)

  13. There are 1000 files, find the ten words with the largest number of occurrences

  14. Algorithm: Merge sorted linked list

  15. Seeing that I have done a plagiarism check system for papers, I asked me what is the core (undergraduate graduation design, sentence algorithm and plagiarism check algorithm, edit distance used) can you talk about edit distance? Did you write it yourself or used someone else's (pyhton package), then can you write one? Write a general idea. (It happened to be practiced before, there is a small flaw, I didn't let it run, the overall code is basically correct)

  16. Seeing that you have used k8s, do you know about deployment? (I don’t know, I just wrote yaml file deployment, I can introduce k8s components, introduced five or six components and functions, and also talked about the load balancing and high availability we did before)

The last thing is to tell me that you can come for an internship when you are free, and ask me if I want to continue the three sessions, or another day, because I have already had two sessions in a row, I said continue

Three sides:

  1. Introduce myself, start discussing projects, and finally talk about my projects. . .

  2. The process of data from disk to program (unsatisfied)

  3. I mentioned Kafka's zero copy again (I think there is a problem)

  4. Ask me protocol model (five layers)

  5. Three-way handshake and four-way wave (stereograph) Why three times? Why four times? (I feel dissatisfied and have discussed with him for a long time) The interviewer thinks that it is generally symmetrical. If it is asymmetrical, it must be combined in a certain link (I said I will go back and look again)

  6. Do you understand Linux memory management? How did you manage it? (Actually, I don’t know, but the interviewer on the second side happened to tell me block storage, so I said block storage, and then segment page storage) He said segment page storage should be very old.

  7. Now let you design a memory management yourself, how do you design it (this place has been discussed for a long time, every time I have a new idea, I will throw out a problem, and then I will think about it...) Finally, there is one that I think is okay, Said that your design is relatively rudimentary (mainly asking how to apply for a large memory, quickly find the available space, and how to minimize memory fragmentation)

  8. Let’s talk about the JVM

  9. hashmap

I can’t remember the rest, it’s stereotyped

Here I recommend a java interview note that I read before the interview:

This information contains a lot of popular java knowledge points. Those who need to get it can directly forward + pay attention to it and private message (learn) to get it for free!

Not much to show, it has everything you want,

Rhetorical question:

I said that I would like to add two points at the end, which can be regarded as showing my advantages: I know that my performance may not be very good today

  • 1) I have a strong learning ability, and many scholarships on my resume are obtained by myself

  • 2) Strong development ability and strong ability to withstand pressure. During Baidu internship, he worked more than twelve hours a day

  • 3) I really don't know much about memory, and I don't explain it, but I have areas that I am good at, for example, I have a better understanding of java

In the end, he said that it was actually ok, and then it disappeared. He thought it was cold, and the hr said it the next day

Generally speaking, it is not particularly difficult. I think it is easier to approve in advance than to recruit in autumn. .

Guess you like

Origin blog.csdn.net/HongYu012/article/details/131896867