The interview experience was good, the interviewer was guiding all the time, but it's been a long time since I've dealt with boilerplate code 🤣
- Position: Backend Development
- Date: 2023-05
- Interview Duration: 1 hour 24 minutes
Java#
Basics#
-
Difference between String, StringBuilder, and StringBuffer
- What is the reason for the better performance of StringBuilder?
-
What are the List implementations used in Java development, and can you explain their characteristics?
- What is the difference between ArrayList and LinkedList?
-
What are the Map implementations used in Java development, and can you explain their characteristics?
- What problems can occur with HashMap in concurrent scenarios, and what methods can be used to solve them?
Concurrency#
-
In what situations do you need to use a thread pool in daily development?
- Why use a thread pool instead of creating a new thread directly?
-
Besides using multithreading, what other approaches do you use to solve concurrency problems in programming (such as locks)?
- Have you used the synchronized keyword in Java, and can you explain how it is generally used?
- Can synchronized be used to modify methods, and what phenomenon does it cause?
-
Usage and differences between Sleep() and Wait() methods
JVM Virtual Machine#
- Are you familiar with Java Virtual Machine (JVM) garbage collection?
- Which GC model is used in your project?
Database#
- What are the transaction isolation levels in MySQL, and can you give an example for each level?
- Can you explain MySQL locks, such as gap locks?
- Are you familiar with indexes?
- Why is the query efficiency of a primary key index faster than that of a regular index?
- What is the difference between a unique index and a primary key index?
Data Structures and Algorithms#
- Introduction to Quick Sort and Heap Sort
- Write the inorder and preorder traversal of a binary tree using recursion
Project#
- Explain in detail about the projects you have worked on
- Why do you use Spring Cloud's OpenFeign to call third-party services in your project?
- How is the log calling chain implemented in the project, and how does it work in practice?
- What are the differences between MySQL and PostgreSQL, and why did you switch the database from MySQL to PostgreSQL?
- How do you achieve a smooth database migration process without stopping the service?
- How to achieve a smooth database switch without stopping the service?
- Scenario: Calling an API where Step A is executed sequentially and Step B is executed asynchronously in the background to record the call logs (which takes longer to execute). Now, if Step A is successful and returned to the user, but the service crashes during the execution of Step B and the logs are not recorded, how would you handle it?