BATJ interview experience sharing + Java interview questions with answer analysis

BATJ interview experience sharing + Java interview questions with answer analysis (14)

Continue to update Java related materials. Recently, a friend who has worked for more than 3 years exchanged his interview experience with me, and he agreed to share it. I hope to give you some help. In addition, if you want to see the first few collections, you can go to my homepage to find it.

Some of the answers are summarized by myself, and some are collected on the Internet. Don't panic after watching these interviews! If you have more experience, you can share it in the comments. If you have any mistakes, you are welcome to point out. Please feel free to enlighten me, thank you

Baidu, Baidu that year I went trick is to stop the community, most departments do not only recruit community school recruit, but a few departments have special approval quota, then went to try one, is to write the code first came to the side,
a After writing the algorithm question of the singly linked list, the interviewer nodded with satisfaction. Then the interviewer asked how spring manages zookeeper in your project. Answer: balabala, do you
know the leader selection algorithm of zookeeper? Tell me about his process. Do you know the zab algorithm? Tell me about his process. Khan and the questions asked are too perverted. I did not expect to ask so deeply. The
zab algorithm is too complicated. Zab is based on paxos, and paxos is the algorithm that won the Turing Award. I reluctantly said it. I was very guilty. There are many blind spots and I didn’t figure it out.
Fortunately, the interviewer didn’t ask anymore. In fact, I guess he wouldn’t know how to do it. Then let me wait a bit. ; After a while, the second interviewer came over. He was a mature uncle. He
only asked two things, one jvm and one concurrent programming. Jvm is mainly for performance tuning, the use of jstack, full GC and minor GC analysis, etc. , Concurrent programming asks very carefully.
Ask multiple threads to reach the same state and then execute together, and then continue to execute concurrently after reaching a certain state. How to achieve this? Answer: There is a CyclicBarrir after jdk5,
which is realized through this. It can be reused and so balabala said something, and then ask how to read and write after reading lock plus lock avoid writing thread starvation, a: feeding strategy balabala, ask how real
is now complete threads of control within a certain period of time, not to complete the respect of the cancellation, A. : Implement the Callable interface, return the FutureTask class or Future interface, and then trigger the undo operation.
I started to ask the project, describe the reconciliation system, balabala...Is the amount of data large, is the amount of concurrency high, how the database is designed, etc. Then let me wait for a while, and another interviewer came over,
Ask me about the business, you are in a third-party payment company, can you talk about the technical process of payment, balabala...Tell me about the payment process that I understand, and finally add one sentence.
The details of payment are very complicated, and I don’t fully understand it. , Khan, let me wait for a while, and then the interviewer said you go back and wait for the news, I think it’s over, is it because I’m not familiar with the business, I’m
really unwilling to do it; my heart is cold for a week, but hr hits on Monday The phone told me to go to the last meeting on Thursday. It was an interview with the technical director. I went there on Thursday
(Baidu Building is too far away from China World Trade Center, and every time I take the subway for an hour and a half, I also kneel). It’s not difficult to ask about the idempotence of asynchronous processing.
Unique indexing or the development of distributed locks. Then the style immediately changed. Regardless of the technology, ask what value you think you can bring to Baidu.
What kind of team do you want the Baidu team you to join, how do you communicate with the product manager, if you and other R&D interface formulations cannot be unified, how do you solve it, etc.,
there is no preparation at all, the answer is stuttering Well, hey, let it be your fate!

Ali


The fifth aspect is Ali. After Baidu interviewed and waited for the news, I checked the company's recruitment information in idle time and saw that Ali's recruitment salary was very attractive.
Haha, I am such an unscrupulous person. I started with a telephone interview, then an interview, two-sided and three-sided. The main interview techniques are
related to JVM: What
is a complete GC process (from ygc to fgc) in jvm? Focus on how objects are promoted to the old age, several major JVM parameters, etc.
Do you know which types of garbage collectors, their advantages and disadvantages, focus on cms
when there is a memory overflow, how do you troubleshoot the
JVM memory model? How much knowledge to understand
Simply talk about
the reflection mechanism of the class loader JAVA you know

Network:
What is the difference between http1.0 and http1.1? The
TCP three-way handshake and the four-wave handshake process? Why does the disconnection take 4 times? If there are only two handshakes, what is
the difference between TIME_WAIT and CLOSE_WAIT?
Tell me what do you know HTTP response code

Architecture design and distribution:
How to tune tomcat, the meaning of various parameters, what are the
common caching strategies, what caching system is used in your project, how to design, what to pay attention to when using Redis, persistence method, memory settings, Clustering, elimination strategy, etc.
How to prevent cache avalanches
How to achieve a unique serial number in
a distributed cluster Design a spike system that automatically closes transactions without payment in 30 minutes
How to make a distributed lock
What MQs have been used, how to use them, and other mqs What are the advantages and disadvantages of the comparison, is the MQ connection thread-safe?
How to ensure that the data of the MQ system is not lost?
The principle of distributed transactions, how to use distributed transactions
What is consistent hash,
talk about several HASH algorithms you know, simple It can also be
what is paxos arithmetic
difference between memcached and redis memory management, and so on
back to my offer. But recently 996 did not know how to choose.

Java Interview Questions (14)

MySql

142. What are the three paradigms of the database?

  • The first paradigm: emphasizes the atomicity of columns, that is, each column of the database table is an indivisible atomic data item.

  • The second paradigm: requires the attributes of the entity to be completely dependent on the primary key. The so-called complete dependence means that there cannot be attributes that only depend on part of the primary key.

  • The third paradigm: any non-primary attribute does not depend on other non-primary attributes.

143. There are a total of 7 pieces of data in an auto-increment table, the last 2 pieces of data are deleted, the mysql database is restarted, and another piece of data is inserted. What is the id at this time?

  • If the table type is MyISAM, the id is 18.

  • If the table type is InnoDB, the id is 15.

 

InnoDB tables only record the maximum id of the auto-incrementing primary key in memory, so the maximum id will be lost after restart.

144. How to get the current database version?

Use select version() to get the current MySQL database version.

145. What is ACID?

  • Atomicity (atomicity): All operations in a transaction, either all completed or not completed at all, will not end in an intermediate link. If an error occurs during the execution of the transaction, it will be restored (Rollback) to the state before the transaction started, as if the transaction had never been executed. That is, transactions are indivisible and irreducible.

  • Consistency (consistency): Before the start of the transaction and after the end of the transaction, the integrity of the database has not been destroyed. This means that the written data must fully comply with all preset constraints, triggers, cascading rollbacks, etc.

  • Isolation: The ability of the database to allow multiple concurrent transactions to read, write and modify its data at the same time. Isolation can prevent data inconsistencies caused by cross execution when multiple transactions are executed concurrently. Transaction isolation is divided into different levels, including read uncommitted (read uncommitted), read committed (read committed), repeatable read (repeatable read) and serialization (Serializable).

  • Durability: After the transaction is completed, the modification of the data is permanent, and it will not be lost even if the system fails.

146. What is the difference between char and varchar?

char(n): fixed length type, such as subscription char(10), when you enter the three characters "abc", they still occupy 10 bytes, and the other 7 are null bytes.

Advantages of chat: High efficiency; Disadvantages: Space occupation; Applicable scenarios: The md5 value of the password is stored, and the use of char is very suitable.

varchar(n): variable length, the stored value is the length of the byte occupied by each value plus one byte used to record its length.

Therefore, it is more appropriate to consider varcahr in terms of space; it is more appropriate to consider char in terms of efficiency, and the use of the two needs to be weighed.

147. What is the difference between float and double?

  • Float can store up to 8 decimal digits and occupies 4 bytes in the memory.

  • Double can store 16-bit decimal numbers at most and occupy 8 bytes in memory.

148. What is the difference between inner connection, left connection and right connection of mysql?

Inner join keywords: inner join; left join: left join; right join: right join.

 

Inner connection is to display the matched related data; left connection is to display all the tables on the left, and the table on the right shows the data that meet the conditions; the right connection is just the opposite.

At last

The content of the interview questions is over here, there will be more updates in the follow-up, I hope it will be helpful to everyone.

Finally, I want to say something to you. I have worked for so many years and have interviewed some people for others. Whether it is from the perspective of the interviewer or the leader, in addition to interview skills and experience, great technology and project experience are also their trump cards and confidence. Core technology sharing of first-tier manufacturers

 It took me a long time to sort out some learning materials. What I posted above is the tip of the iceberg in the materials. I hope I can help you! Click to learn the secret code together: csdn

                         

  I will share more pure dry goods articles in the follow-up, and hope to really help you. Your support is my biggest motivation! Welcome to follow and like!

                                                       

Guess you like

Origin blog.csdn.net/weixin_50333534/article/details/108987828