Java development interview frequently asked questions of major Internet companies

I am a Java developer. This is a frequently asked question when I participate in 58, Sohu, Sogou, Sina Weibo, Baidu, Tencent Literature, NetEase and some other small start-up companies. Of course, there are repetitions. , I believe the interview will be much easier.

1. The usage of junit, the execution order of before, beforeClass, after, afterClass 2.
Distributed lock
3. The request forwarding algorithm of nginx, how to configure the forwarding according to the weight
ConcurrentHashmap)
5. Thread status
5. Thread blocking method
6. The difference between sleep and wait
7. The underlying implementation of hashmap
8. Ten thousand people grab 100 red envelopes, how to achieve (without queue), how to ensure that 2 people cannot grab To the same red envelope, distributed locks can be used
. 9. Java memory model, garbage collection mechanism, unreachable algorithm
changes will be found

 


11. The underlying implementation of aop, how dynamic is the dynamic proxy, if there are 100 objects, how to dynamically proxy these 100 objects
12. Have you used maven install before? maven test. git (make install is to install a local jar package)
13. Various configurations of tomcat, how to configure docBase
14. Several ways of bean configuration of spring
15. Configuration of web.xml
16. Listener of spring.
17. The implementation mechanism of zookeeper, there is a cache, how to store the registered service
18. Will IO block? Is readLine blocking
19. Have you used spring's thread pool or java's thread pool?
20. Formatting method of strings (20, 21 are too low-level questions)

 


21. Formatting method of time
22. What does the timer do
23. How does the thread exit and end
24. What locks does java have? Optimistic lock, pessimistic lock, synchronized, reentrant lock, read-write lock, have you used reentrantlock? The difference between reentrantlock and synmchronized
25. ThreadLocal usage scenarios
26. Java memory model, garbage collection mechanism
27. Why thread execution calls start instead of direct run (direct run, no different from ordinary methods, first adjust start, then run will Running as a thread method)
28. Implementation mechanism of qmq messages (qmq is a message queue encapsulated by Qunar.com itself)
29. Three ways to traverse the hashmap

30. Some commands of jvm

 

 

31. Difference between memcache and redis

32. Where is the row-level lock of mysql
added? 33. How is the lock of ConcurrentHashmap added? 34. The difference between myisam
and innodb (innodb is a row-level lock, myisam is a table-level lock)
35. Other performance optimization methods of mysql

36. Where to read the linux system log

37. How to view network processes

38. Count the number of 1 bits in the binary representation of an integer

39. jvm memory model, java memory model

40. How to dump all the data in java memory

 

41. How to manually trigger full garbage collection and how to trigger garbage collection immediately

42. What's wrong with hashmap if there is only one write and other full read

43. git rebase

44. Difference between mongodb and hbase

45. How to solve concurrency problems
46. The purpose of volatile
47. Java thread pool (as if there was a problem with my understanding before)
48. Binlog of mysql
49. Proxy mode
50. How does mysql implement transactions

 

51. When is the read-write separation forced to read the main library, which slave library is read by what method, and what method is used for mysql synchronization of the slave library
52. ​​The storage engine
of mysql 53. The default isolation level of mysql, other isolation levels
54. Reverse a linked list (using three pointers, but only one at a time)
55. The implementation principle of spring Aop, specifically
56. When will memory leak, what exceptions will be thrown by memory leak
57. Whether to use Annotated by Autowire
58. Spring's way of injecting beans
59. The execution order of various conditions of SQL statements, such as select, where, order by, group by
60. select xx from xx where xx and xx order by xx limit xx; How to optimize this (see explain)

 

61. Four elements to write code

62. Count the 100 IPs with the most ip occurrences in the 100G ip file
63. Zookeeper things, nodes, and service providers hang up how to inform consumers
64. How 5 servers elect a leader (election algorithm)

65. The difference between adapter and proxy mode
66. Read-write lock
67. Static lock
68. Transaction isolation level
69. Facade mode, class diagram (appearance mode)
70. How does mybatis map the table structure

 

71. Binary tree traversal
72. Master-slave replication
73. Difference between mysql engine
74. Which area is the static inner class loaded into? method area

75. Where is the class file loaded after compilation?

76. How does the overall response time of the http request of the web increase and the number of processed requests decreases, how to deal with it? Using a queue, when you can't handle so many http requests, put the request in the queue
and process it slowly, how does the web implement the queue

77. Thread-safe singleton pattern

78. Quicksort performance considerations

79. volatile keyword usage

80. Find the size of the table, or what storage engine can be used for data statistics

 

 

81. What engine is available for reading more and writing less

82. What engine should be used if you want to count multiple tables

83. How to lock the size of concurrenhashmap, and what to do if the paragraph changes after just asking for a paragraph

84. 1000 apples in 10 baskets, how to put them, so that I can get all possible numbers

85. Reentrant read-write lock, how is reentrancy implemented?

86. Have you used NIO?

87. Have you used the concurrent package of java?

88. What objects are newly created on the stack by sting s=new string("abc")

89. The area allocation of the java virtual machine, what is stored in each area

90. Distributed Transactions (JTA)

 

91. Issues that should be paid attention to when using threadlocal (ThreadLocal and Synchonized are both used to solve concurrent access of multiple threads. But ThreadLocal is essentially different from synchronized. Synchronized is the use of a lock mechanism, so that variables or code blocks can only be accessed by one at a time. Thread access. ThreadLocal provides a copy of the variable for each thread, so that each thread does not access the same object at a certain time, thus isolating the data sharing of data by multiple threads. Synchronized is just right Instead, it is used to obtain data sharing when communicating between multiple threads)

92. What containers does java have (collections, tomcat is also a container)

93. Binary search algorithm 94.
The advantages of myisam and the difference between innodb and innodb Is the memory space swapped into the disk? (This should be possible, but the interviewer told me not to) 99. There are two thread pools based on cache and fixed length in the java thread pool. What are the differences when there are too many requests? dealt with? Queue for fixed-length things, what if the queue is full? Swap into disk? What about a cache-based thread pool solution? 100. What lock does synchronized add to the method?





 

101. The difference between lock and trylock in reentrant locks
102. Will innodb's reading of a row of data be shackled? No shackles, the actual reading is the copy
103. Is redis distributed for caching? Is the data stored on different servers duplicated? What about guava cache? Is it redundant? Different machines store different data
104. Use awk to count the top10 in an ip file
105. When making statistics on a table, you can directly view the schema info information, that is, view the system information of the table
106. The current version of mysql is
107. The company has rich experience What help did people give? (Generally, these will be asked at the boss interview)
108. What advantages do you have over the same fresh graduates?
109. How does your good summary habit help you in your future work?

110. Atomic classes, thread-safe objects, exception handling

 

11.1. 400 million int numbers, how to find the repeated number (using the hash method, build a hash array of 2 to the 32th power bit, every time an int number is taken, you can hash it to the 32nd power of 2 to find it in the hash The position in the array, and then set the bit to 1 to indicate that it already exists)
11.24 billion urls, find out the duplicates (consider insufficient memory, assign the urls to 1000 files through the hash algorithm, and the difference between different files must be There are
10,000 arrays, each array has 1000 integers, each array is in descending order, and find the largest N number, N<1000

113. The underlying implementation of LinkedHashmap
114. The purpose of the version number of the class when the class is serialized. If a version number is not specified, how does the system handle it? What if fields are added?
115. The difference between Override and Overload, in what scenarios are they used in?
116. How is java reflection implemented?

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326444977&siteId=291194637