Preface: As a Java server development engineer who graduated from university in 2011, I began to conduct routine internship interviews from October, 2013 (the first year of my junior year), during which I received offers from Xiaomi, Kuaishou, linkedin and Tencent. However, due to the outbreak of the epidemic, I could not start my job on time. I successfully entered Tencent as an intern in spring recruitment in March, 2012 (20.03-20.09). After joining Tencent as a regular member, I conducted autumn recruitment (20.09-20.11). Finally, I successfully obtained offers from Tencent, Alibaba, Kuaishou and Baidu. During the whole period of job hunting, I have experienced nearly 50 interviews. Here I will sum up my personal face comprehensively, hoping to help interview partners!


The operating system

1. Processes, threads, coroutines
1. What is the difference between a process and a thread? There are two threads a, B, and A in a process. The status of thread AB is abnormal. 2. The implementation principle of coroutine 3. The method of thread communication, whether the pipeline is orderly, how to realize the message queue? What is a semaphore? 5. What does a thread share with a processCopy the code
2. Synchronous and asynchronous
IO multiplexing, NIO model 3. Epoll and SELECT differences 4. AIO NIO BIO differencesCopy the code
3. The memory
How to implement Linux shared memory 2. How to implement Linux memory management? 3. What is the principle of finding a string in a file? 4. Do I flush disk or memory first? How does Linux check system state? How does Linux check thread stateCopy the code

concurrent

Deadlock, deadlock conditions, deadlock prevention, optimistic lock pessimistic lock, advantages and disadvantages 2. Implementation principle of thread pool, parameters of thread pool, execution process of thread pool, reject policy 3. How many ways can Java create threads? The concept of thread insecurity 9. The role and usage scenarios of ThreadLocal 10. How does CAS 11.java allow three threads to execute simultaneously? Communication mode between Java threads 13. Implementation principle of AtomicInteger 14. The program is designed to perform several tasks concurrently, and then execute them sequentially. 17. Is the lock in the heap or on the stack? Why not on the stack? 18. What are concurrent sets?Copy the code

The JVM virtual machine

1. The thread CPU usage is high. How to locate the specific line of code? 2. Java garbage collection, will garbage collection occur after system.gc () is called? 3. When is garbage collection (new generation + old generation)? What are the garbage removal algorithms, advantages and disadvantages? Why does the new generation use copy algorithms? Garbage collector 4. Virtual machine memory partition 5. How string storage is stored in memory 6. Java thread model (many-to-one, one-to-many, many-to-many, etc.) 7. Class loading mechanism 8. How is Java platform independent implemented? Does jdK8 have a method area? Why not? 9. Locate and troubleshoot memory overflow problems according to what indicators? What's the screening process like? 10. Do you know registers? 11. How to customize a class loader? JVM parameters tuning 13. JVM full gc frequently 14. Parental delegation model, what other models do you know? 15. When will stack overflow occur? Static variables can overflow the stack (Stackoverflowerror & outofMemoryError). Object memory allocation? When will the object enter old age?Copy the code

Java based

Set 1.
Comparison of ArrayList and LinkedList 3. Conversion of HashMap length 8 into red-black tree What is the time complexity of hashmap.get ()? 5. How to obtain the hash value of HashMap? 6. Dimension of segment lock? 7. How is iterator used and how does it workCopy the code
Basis of 2.
1. Float a =3.14 How to modify? 2. Switch can store what type 3. 5. What is serialization 6. How many bytes does int have? What's the difference between 32-bit and 64-bit? 8. Equal and hashcode rewrite 9. Java is passed by value or by reference, String? Struct and union in C 11. Jdk8 new features, new advantages 12. How many variables can be generated in a string? Does it have to be two? The implementation of dynamic programming 15. The understanding of lambAM expressions 16. The underlying principle, function 17. What is the difference between shallow copy and deep copy? What do they mean, respectively?Copy the code
3. Design patterns
1. Singleton mode (lazy, hungry) 2. Factory mode 3. Observer mode 5. Adapter modeCopy the code

The framework

1. SpringBoot & Spring
1. Why SpringBoot? Spring Bean lifecycle 3. Spring features 4. Spring IOC is how to implement 5. Springboot @SpringBootApplication is how to implement class loading 6Copy the code
2. SpringMVC
1. Implementation of SpringMVC interceptor 2. Implementation process of SpringMVC 3. Talk about five annotations commonly used by SpringMVCCopy the code
3. Mybatis
2. Mybatis cacheCopy the code

The database

1. Mysql
1. Mysql storage engine is different from Mysql storage engine. 2. Mysql > select * from Mysql; Mysql > select * from Mysql; Mysql > select * from Mysql; When does it expire? Pros and cons of indexes? Implementation principle (B + tree), why not use B tree and hash, how to implement overwriting index? 5. Difference between relational and non-relational databases 6. Difference between primary key and foreign key 7. SQL optimization methods, specific scenarios 8. 9. What is a transaction? Feature? The isolation level, which causes problems 10. Talk about MVCC, gap lock Use SQL to write: get all information about a class ranked third and gender maleCopy the code
2. Redis
1. Why Redis 2. What is cache throw? How to solve it? 3. How is message queuing implemented? 4. Basic data structure of Redis, implementation principle of ZSET, time complexity of skip table? Does the time complexity change if the interval changes? 5. Redis persistence mode (RDB, AOF is more detailed, RDB is to synchronize all data back to disk) 6. What are the basic types? How to resolve inconsistency with database data? 7. With millions of data in a Redis cluster, how do YOU find some dataCopy the code

network

1. TCP&UDP
1. Detailed TCP and UDP, TCP reliability is how to achieve? 2. What happens when the THIRD TCP handshake fails on the client and server? TCP congestion control 4. TCP three-way handshake 5. TCP data integrity. How to confirm a TCP connection is downCopy the code
2. Other
1. Seven-layer network model: Function, protocol, five-layer model 2. Difference between DNS recursion and iteration 3. HTTP protocol 4. Session creation process 6. The difference between GET and POST 7. The difference between HTTP and TCP, why have HTTP also have TCP? 8. HTTP status code 9 Difference between forwarding and redirection 10. What happens when you enter a URL in the browser 11Copy the code

distributed

1. Implementation principle of distributed transaction 2. Function of ZooKeeper, election mechanism, data synchronization mechanism 3. Implementation principle of consistent Hash 4. Implementation principle of Nginx load balancing, specific algorithm 5. How is service governance implementedCopy the code

Git&Maven

Git commands: rebase, pick 4. Maven and GradleCopy the code

The data structure

1. Big data scenario
1. How is a billion data stored? How is string hash implemented? Mapping principle? 2. 10 billion data to find a thousand largest numbers, the blogger answered the heap, heap time complexity, there is another method? 2:3. Restricted to a 500 Megabyte file, eliminating duplicates among hundreds of millions of phone numbers starting with 187? Given two files A and B, each containing 5 billion URLS, each containing 64 bytes, the memory limit is 4 gb, let you find the common URL of a and B. = = = = = = = = = = = = = = = = How does a 100W line file view the fourth column?Copy the code
2. Basic algorithms
1. Quickly find the same number in two arrays 2. Reverse linked list + variable name hump conversion 3. Depth and breadth, depth and breadth correspond to stack and queue respectively what 5. 6. Sixty percent of people like basketball, 70 like football, and 80 like volleyball. Find the probability of both football and basketball 7. Red-black and B + tree search deletion efficiency 8. Coin toss calculation probability problem, take turns to toss who first to heads who wins? Find the smallest number of k in an unordered array (dichotomy) 10. Find the number of squares of an ordered array 11. 12. What is the time complexity of bubbling? What about the time complexity? What does the data structure consist of (three major features) Find the maximum xor of array 16. Horse racing problem 17. Implement a lottery system 18. How to find the sum of paths in a Huffman tree 19. Find a string that is repeated only once in a set of strings 20. Leetcode1054 Bar code 23. []={10, 13, 16, 20, 25, 2, 5, 8}; []={10, 13, 16, 20, 25, 2, 5, 8}; Let a[] be cyclic incremented by 25. 26. Write a function that adds two binary strings 27. Delete all the same nodes from the linked list. 29. How to determine if a linked list has rings 30. Implement the stack with arrays 31. Find the KTH smallest number in two incrementing arrays 32. Flip the array to find the subscript of one of the numbersCopy the code

other

1. Tomcat tuning 2. Specific structure of the project and access 3. Implementation of the message notification module in the project 5. Where is the thread pool used in the project 6. The bottleneck of a single architecture (CPU, IO, bandwidth) and how to optimize it, why a large number of visits will occupy CPU resources 7. What kinds of diagrams are there in UML? What are the characteristics of use case diagrams? What are the steps involved in converting a class diagram? 8. What are the development models? What are the processes involved in the waterfall development model? 9. Has the implementation of single sign-on ever been used with the mobile terminal? 10. Simply realize the high concurrency of the code of order withholding inventory, and solve the overselling of inventory 11. 12. CPU big endian small endian 13. What is front-end and back-end separationCopy the code

I spent one day summarizing all the questions I met in the previous interview, and I will compile a list of answers later (Check out my next article), I hope I can help you! Welcome to my blog:Personal blog