[Mianba] In October, the latest 184 Alibaba, Baidu, Tencent, and Toutiao Java interview questions were offered softly!

The latest real interview questions for first-line Internet companies collected in 2020 (all organized into documents), there are a lot of dry goods, including
detailed explanations of netty, spring, thread, spring cloud, etc., there are also detailed learning plans, interview questions, etc. I feel that I am in the interview This section is very clear: to get the interview information, just: click here to get it!!!
Password: CSDN

Insert picture description here

Ali interview questions

  1. How to achieve an efficient reverse output of a singly linked list?
  2. It is known that sqrt(2) is approximately equal to 1.414, and it is not required to use a math library. Please find sqrt(2) accurate to 10 digits after the decimal point
  3. Given a binary search tree (BST), find the Kth smallest node in the tree
  4. LRU caching mechanism
  5. Regarding the difference between epoll and select, which of the following statements are correct
  6. From the analysis of the index structure of InnoDB, why the key length of the index cannot be too long
  7. How to restore MySQL data to any point in time?
  8. NFS and SMB are the two most common NAS (Network Attached Storage) protocols. When a file system is shared to multiple hosts through NFS and SMB at the same time, which of the following statements are wrong
  9. Enter ping IP and press Enter. What will happen before the packet is sent?
  10. Please explain why the Weibo system crashed when Lu Han posted his relationship, how to solve it?
  11. An existing batch of emails needs to be sent to subscribing customers, and there is a cluster (the number of nodes in the cluster is variable and will dynamically expand and shrink) to be responsible for the specific email sending tasks. How to make the system complete the sending as soon as possible?
  12. There are a number of meteorological observatories. Now it is necessary to obtain the observation data of these stations and store them in Hive. However, the Meteorological Bureau only provides api query, which can only query a single observation point at a time. So if you can easily and quickly get the data of all observation points?
  13. How to add two amounts of data (up to two decimal places)
  14. Some basic open questions about parallel computing
  15. Please calculate how much TOPS the computing power of XILINX VU9P chip is equivalent to, and give the calculation process and formula
  16. How many simple MOV instructions can be executed per second on a modern processor, and what are the main influencing factors
  17. Please analyze the relationship between MaxCompute products and distributed technology, the current market status and development trends of big data computing platform products
  18. How do you understand the metadata management in the big data platform, what is the metadata collection management system, and what impact will it have on big data applications?
  19. You understand the technical system differences, development trends and technical bottlenecks of common big data platforms such as Alibaba and other big data platforms, and outline the two aspects of storage and computing
  20. In the cloud computing big data processing scenario, thousands of tasks are running every day, and each task requires IO read and write. In order to provide better service, the storage system often ensures that high-priority tasks are executed first. How to ensure priority and fairness when multiple jobs or users access the storage system
  21. Maximum frequency stack
  22. Given a linked list, delete the Nth node from the bottom of the linked list, and return the head node of the linked list
  23. If you are asked to design a universal system that supports second-level backup and recovery of various databases, how would you design
  24. If you were asked to design a data flow and processing system that supports the real-time flow of data between databases, NOSQL and big data, what issues would you consider? How to design?
  25. Given an integer array and an integer, return the indexes of the two arrays. The sum of the numbers pointed to by these two indexes is equal to the specified integer. Need the best algorithm, analyze the space and time complexity of the algorithm
  26. If you are given a new product, from what aspects will you guarantee its quality?
  27. Please evaluate the execution result of the program?

(There is a way to receive answers at the end of the article)

Tencent interview questions

Java basics
1. What are the several basic data types in JAVA and how many bytes they occupy
2. Can the String class be inherited? Why
3. The difference between String , Stringbuffer, and StringBuilder
4. What is the difference between ArrayList and LinkedList.
5. Talk about the instantiation order of classes, such as parent class static data, constructors, fields, subclass static data, constructors, fields, and their execution order when new.
6. What are the differences between which Map classes have been used, is HashMap thread safe, what Map is used concurrently, and what are their internal principles, such as storage method, hashcode, expansion, default capacity, etc.
7. Why did the ConcurrentHashMap of JAVA8 give up the segment lock? Is there any problem? If you design it, how do you design it.
8. Are there any Map implementation classes in order, and if so, how do they ensure ordering?
9. The difference between abstract class and interface, can a class inherit multiple classes, can an interface inherit multiple interfaces, and can a class implement multiple interfaces?
10. What is the difference between inheritance and aggregation.
11. What are the IO models, talk about nio you understand, what is the difference between him and bio, aio, talk about the reactor model.
12. The principle of reflection, what are the three ways that reflection creates class instances.
13. In reflection, the difference between Class.forName and ClassLoader.
14. Describe several implementations of dynamic agents, and state their respective advantages and disadvantages.
15. The difference between dynamic proxy and cglib implementation.
16. Why the CGlib method can implement proxy for the interface.
17. The purpose of final.
18. Write three singleton mode implementations.
19. How to automatically complete all hashcode and equals implementations for subclasses in the parent class? What are the advantages and disadvantages of this.
18. Please talk about the role of access modifiers public, private, protected, and default in application design based on the OO design concept.
19. The difference between deep copy and shallow copy.
22. Array and linked list data structure description, their respective time complexity.
20. The difference between error and exception, CheckedException, RuntimeException.
21. Please list 5 runtime exceptions.
22. In your own code, if you create a java.lang.String class, can this class be loaded by the class loader? why.
23. Tell me about your understanding of the hashCode and equals methods in the java.lang.Object object. Under what circumstances need to re-implement these two methods.
24. In jdk1.5, generics are introduced, and the existence of generics is used to solve problems.
25. What is the use of such a.hashcode() and what is the relationship with a.equals(b)?
26. Is it possible that two unequal objects have the same hashcode.
27. How does HashSet in Java work internally.
28. What is serialization, how to serialize, why serialization, what problems will be encountered in deserialization, and how to solve them.
29. New features of java8.

JVM

33. Under what circumstances will stack memory overflow occur.
34. JVM memory structure, the ratio of Eden and Survivor.
35. Why should JVM memory be divided into new generation, old generation and persistent generation. Why is the new generation divided into Eden and Survivor.
36. What is a complete GC process in JVM, how to promote the object to the old age, and talk about the main JVM parameters you know.
37. Do you know which kinds of garbage collectors, their advantages and disadvantages, focus on cms and G1, including principles, processes, advantages and disadvantages.
38. The realization principle of garbage collection algorithm.
39. When there is a memory overflow, how do you troubleshoot?
40... How much do you know about the relevant knowledge of the JVM memory model, such as reordering, memory barriers, happen-before, main memory, working memory, etc.
41. Simply talk about the class loader you know, can you break parental delegation, and how to break it.
42. Talk about the reflection mechanism of JAVA.
43. What are the JVM parameters of your online application?
44. The difference between g1 and cms, throughput priority and response priority garbage collector selection.
45. How to print thread stack information.

Baidu interview questions

1. Define a character array in the function. When inputting a string with the gets function, why the program will crash if the input is out of range 2. The difference between a reference and a pointer in
C++ 3. The memory partition of a C/C++ program
4. Quick sort Ideas, time complexity, implementation and optimization methods
5. IO model-IO multiplexing mechanism?
6. Commonly used Linux commands
7. 7. What are the storage types of variables in C?
8. 8. The essence of dynamic programming
9. 9. How to optimize MySQL in practice?
10. 10. Under what circumstances are indexes set but cannot be used?
11. 11. SQL statement optimization
12. 12. The underlying implementation principle of database indexes And optimization
13. 13. The main difference between HTTP and HTTPS?
14. 14. How to design a highly concurrent system?
15. 15. Two intersecting singly linked lists, how to find their first common node?
16. 16 . Find the ring entry of a one-way partial circular linked list?
17. 17. How to store the IP address in the database?
18. 18. The underlying implementation of new/delete and malloc/free?
19. 19. Introduction to overload, override, and override?
20. 20. Little-endian/big-endian machine?
21. 21. Daemon
22. 22. Advantages and disadvantages of multithreading
23. 23. Long and short connections
24. 24. Bipartite graph applied to the best matching problem (visitor pair The biggest problem with the sum of room satisfaction)
25. 25. The difference between class and struct?
26. 26. Virtual function and pure virtual function
27. 27. menset() function
28. 28. Implement a function, for a positive integer n, calculate the minimum number of operations required to get 1. The operating rules are: if n is an even number, divide it by 2; if n is an odd number, you can add 1 or subtract 1; continue processing.
29. 29. Find an array that satisfies the conditions.
30. 30. A large record containing 50M URLs and a small record containing 500 URLs. Find the same URL in the two records
31. 31. Massive log data, Extract the IP32 that has the most visits to Baidu on a certain day. There are 10 files, each file is 1G, and each line of each file stores the user's query, and the query of each file may be repeated. How to sort by query frequency?
32. 33. Ant climbing pole problem
33. 34. When I enter a url in the browser and press Enter, what happens in the background? For example, after entering the url, you see the homepage of Baidu, then how did all this happen?
34. 35. To determine whether two trees are equal, please implement a comparison of whether the two trees are equal, return 1 if they are equal, otherwise return other values, and explain the complexity of the algorithm
35. 36. The problem of crossing the river between three policemen and three prisoners
36. 37. Find the most popular 10 items from 3 million strings
37. 38. How to find the sibling words in the dictionary. Given a word a, if another word b can be obtained by exchanging the order of letters in the word, then b is defined as a sibling word. Now given a dictionary, the user enters a word, how to find out how many sibling words the word has?
38. 39. Find the number that appears more than half of the time in the array. Now there is an array. It is known that a number appears more than half of the time. Please use an O(n) algorithm to find this number.
39. 40. Find out the modified number
40. 41. Design the data structure of the cache in the DNS server. It is required to design a DNS Cache structure, which can satisfy more than 5000 queries per second, meet the rapid insertion of IP data, and the query speed should be fast. (The title also gives a series of data, such as: the total number of sites is 50 million, the IP address has 10 million, etc.)
41. 42. Find out the serial number corresponding to a given string
42. 43. Find out the kth Where the big numbers are. Write a program to find the k-th size number in the array and output the position of the number. For example, in {2,4,3,4,7}, the first largest number is 7, and the position is 4. The second and third largest numbers are 4, and the position is 1 or 3. You can output whichever you want.
43. 44. Give 4 billion non-repeated unsigned int integers, which are not sorted, and then give a few more numbers. How to quickly determine whether these numbers are among the 4 billion numbers?
44. 45. In There are 10G integers in a file, arranged out of order, and it is required to find the median. The memory limit is 2G.
45. 46. How many times does the hour, minute, second hand overlap in a day? (24 hours)
46. ​​47. Combine multiple sets into sets without intersection. 48. There are 11 points in the plane, which are connected to form
47. 48 different straight lines. How many triangles can be connected to these points?

Today's headline interview questions

1. I went to an island to hunt for treasure, and finally found a total of 100 gold coins. They agreed on a distribution plan.
2. Give you an ordered array of integers. The numbers in the array can be positive, negative, or zero. Please implement a function that returns an integer: How many different values ​​are there in the square of all the numbers in the array.
3. 3. A ring has 10 nodes, numbered 0-9. Starting from 0 o'clock, taking N steps to return to 0 o'clock, how many ways are there?
4. 4. For a random array, find the Kth largest number. The sorting method uses lexicographic order.
5. Find the maximum path length for a binary tree. (I.e. the sum of the maximum left and right subtree heights)
6. 6. The difference between process and thread, can using threads really save time?
7. 7. The scheduling method of go coroutine, can using coroutine really save time?
8. 8. What is the difference between horizontal trigger and edge trigger? Under the edge trigger, a socket has 500 data, 200 has been read and then no longer processed, will the remaining 300 never be read?
9. 9. There are functions as follows, input 1, what will return?
10. 10 Design the http protocol, A-end sends AAAA, at least let B know that AAAA has been sent.
11. 11. The total traffic entrance is api_gateway. If api_gateway is suspended, all will be suspended. What mechanism is used to increase availability?
12. 12. Why does mysql use b+ tree instead of balanced binary tree as index structure?
13... What should be considered when creating database indexes?
13. What are the advantages and disadvantages of using int as primary key and using string?
14. 15. How to divide the database into tables?
15. 16. The table structure, the order record is as follows, write a sentence to ask for the best top 10 product_id.
16. 17. Microservices, A service requests B service B1 interface, B1 interface requests A service A2 interface. Will there be a problem?
17. 18. Do not use advanced tools, only use the tools that come with Linux, how would you debug?
18. 19. How to estimate the performance of a mysql statement?
19. 20. In the go function, the return value is unnamed and a panic occurs, but it is recovered in the function. What value does the function return?
20. 21. In the socket, at the TCP protocol level, the data is divided into 10 packets for distribution. 1-7 times went well, and lost for the 8th time. Must this communication fail? If the data will be retransmitted for the 8th time, is it at the receiving end: first read the data for 1-7 times, and then read the data for 8-10 times? Or will the data for 9-10 times arrive first?
21. 22. free -h, what is the difference between buffers and cached
22. 23. What are the characteristics of background processes, if you want to design a process to be a background process, what would you consider
23. 24. What is a zombie process, if one Zombie processes, how to find zombie processes
24. 25. What is an orphan process?
25. 26. A process has 20 threads. If fork is called in a certain thread, will the new process have 20 threads?
26. 27.
What is the difference between tcp/ip flow control and congestion control 27. 28. 301/302? What are the similarities and differences in applications.
28. 29. What is the meaning of 50X related error codes?
29. 30. What are close wait and time wait? How to troubleshoot? what sense?
30. 31. What are the data in http req and resp
31. 32. What is the half-open and half-closed state of the connection
32. 33. If a business relies on a single point of redis, this redis failure will cause the business to be unavailable, how to improve
33. 34. What are the methods of redis sharding?
34. 34. When a large amount of data is required to be saved in redis, a single machine and a single point cannot meet the needs , Design (change to find) a load balancing scheme
35. 36. When redis uses hash for sharding, there are now 8 nodes, and the load scheme is pos = hash(key)% 8, and then save it on the pos node. What are the advantages and disadvantages of doing this? What should I do when 8 nodes are to be expanded to 10 nodes? Is there any more convenient expansion plan? (Consistency hash, presharding)
36. 37. How to ensure the consistency of redis and database data. For example, the user name is not only stored in the database, but also stored in redis as a cache. The following operations are update_db(username); update_redis(username). But after the update_db is executed, it fails and update_redis is not executed. Is there any simple way to solve this problem.

Final answer

The latest real interview questions for first-line Internet companies collected in 2020 (all organized into documents), there are a lot of dry goods, including
detailed explanations of netty, spring, thread, spring cloud, etc., there are also detailed learning plans, interview questions, etc. I feel that I am in the interview This section is very clear: to get the interview information, just: click here to get it!!!
Password: CSDN
Insert picture description here

Guess you like

Origin blog.csdn.net/a3961401/article/details/109298003