This article has participated in the weekend learning program, click the link to see more details: juejin.cn/post/696572…

First describe the background. In the middle of May this year, I joined my current company, Base Beijing. I worked in a company in Wuhan for less than two years as a fresh graduate in 2019. The idea of changing jobs came at the wrong time in early April, and one of the riskiest was not having done any interview preparation. Now I have been employed for about two weeks. I would like to sort out the interview topics I experienced at that time, which will provide some clues for my future study and welcome everyone to discuss.

golang

Based on the relevant

  1. What is the difference between var and := to define variables? What’s the difference between new and make initializing a variable?
  2. What does defer do, and what happens if there are more than one in an application?
  3. How is the bottom layer of slicing implemented? Do you understand the two uses of interface? Do you understand the underlying implementation of interface?
  4. How to use map, will there be concurrency problems? How to find the length of a map (len). Can sync.Map use len to find the length? (sync.map)
  5. There is a difference between buffered and unbuffered channels
  6. What happens if there is no default in select? (Select blocks until a case can be executed.) What happens if a channel in a case is closed? (If this is the only one, it will loop forever. You can use “OK” to check.)
  7. Is the map ordered? How does the underlying map implementation handle hash collisions?
  8. The implementation principles of RECOVER and Panic
  9. Do you understand reflection
  10. What is the difference between using a regular map lock and using sync.map? (Use and performance respectively)

Concurrent related

  1. Golang coroutine scheduling, talk about the UNDERSTANDING of GMP model
  2. How to implement concurrency?
  3. How do I make coroutines wait?
  4. What about the Goroutine spill? How to avoid and troubleshoot goroutine leaks?
  5. Goroutine’s state machine
  6. Talking about channel properties, what happens when you get data from a nil channel?

other

  1. What situations can panic occur? Can all panic recover? How to capture the use of the recover function?
  2. What does context do?
  3. Is there any way to get a link to a function call?
  4. How to deal with the timeout problem of coroutine running?
  5. How do you gracefully close the aisle?
  6. Talk about the differences between Java and Golang from an object-oriented perspective
  7. The GC golang
  8. Golang HTTP routing implementation? Can you describe it?
  9. What is the possible cause of golang program hang (it said that GC could not be caused by an infinite loop, Golang1.13), how to troubleshoot (pprof can be used)

The data structure

  1. What is the time complexity of array lookup, and why?
  2. Do you know anything about jumpers?
  3. Which tree structures do you know, and what are their strengths and weaknesses? (Even better, include application scenarios when answering)

The operating system

  1. Have you ever used a lock? Does read/write lock block write operations when adding a read lock? Does it block read operations? (Yes, yes, no)

Linux

  1. Have you solved any problems with the PS command? What are the meanings of each field in the query result?
  2. Know anything about zombie progression? How to avoid it?
  3. /proc/pid = / pid = / pid = /proc/pid = / pid = / pid = / pid How to find pid according to the port number (lsof I)

The database

  1. What is the difference between Redis and MySQL? When do we use Redis and when do we use MySQL? If you could design a seckill system, what would it be? (The interviewer later pointed out that Redis had another self-increment key.)

MySQL

  1. How many levels of isolation are there? What is the default level? How does repeatable read solve phantom reading? Know anything about MVCC? Which of the following mysql uses a federated index
Select * from table where a=1 and b=1 and c=1;
Select * from table where a=1 and b>1 and c=1;
Select * from table where a=1 and b>1 order by c
Copy the code
  1. Why mysql uses B+ tree instead of red black tree
  2. There is a table where the ID field is unique and the name field can be repeated. Write an SQL statement to query for all records with duplicate names. Select group_concat(id) from XXX group by name
  3. What index engine is used in MySQL (InnoDB), let me explain why innoDB (B + tree) uses B + tree instead of red black tree or B tree (red black is binary, B tree stores extra business data) b+ tree search time complexity (O(logn)). Innodb does not use table locks if an SQL statement does not use an index. Innodb does not use table locks if an SQL statement does not use an index. Innodb uses table locks if an SQL statement does not use an index.

Redis

  1. What about cache breakdown? How to implement bloom filter?
  2. What kind of structure are there and what are the hoppers used to achieve? Does SDS know
  3. Redis. Which structures have been used? The answer is only string. Lpush and LPOP are a couple? Judge, Alarm, smsGateway
  4. How does Redis set the expiration time?

coding

  1. Implement collection
  2. Implement queues with arrays
  3. The output of the following code
X := []int{1,2,3} Func(arr []int){arr[0] = 7 arr = append(arr, 100) arr = append(arr, 100) 101) fmt.Println(arr) }(x) fmt.Println(x)Copy the code
  1. Data is sent when it reaches 100, and if it hasn’t reached 100 for a certain amount of time, it’s also sent.
  2. Write a program. The number of tasks is m and the maximum concurrency is N. There was a task execution error and all the Goroutines quit.

algorithm

  1. Gobang was awarded the win
  2. Array to find duplicate numbers. The length is n, and the numbers in the array are non-negative integers less than n
  3. Maximum suborder sum
  4. 25 horses, five tracks, a couple of times to finish in the top three
  5. Bidirectional linked lists are reversed every two times
  6. Browser forward and back, how to design? (With two stacks)
  7. Fast row
  8. Binary search
  9. There are 10 IP addresses, 3 of which are duplicate and out-of-order, and the output of out-of-order IP addresses is as follows: The duplicate IP addresses are not adjacent
  10. Verifies that a string is a floating point number
  11. The largest sum divisible by three

other

  1. What happens between the time the browser enters a URL and the time the page is displayed, as detailed as possible
  2. Traffic hijacking, okay? For example, entering baidu.com leads to Xiaomi.com.
  3. Open-ended question: Give one hour to stand in front of the company and make an estimate of how many people will come to interview during the day.