Home > other >  Have recently to move, let's review the interview ~ ~ ~
Have recently to move, let's review the interview ~ ~ ~

Time:11-26

Golang interview questions to sort out

1, go scheduling
2, can go struct is

Because it is a strongly typed language, so can't compare the different types of structure, but the value of the instances of the same type can be compared, instance can not compare, because is a pointer type
3, go defer (the for defer), advanced after out, last in, first out

Func (b) {
For I:=0; i <4. I++ {
Defer FMT. Print (I)
}
}
4, select can be used for what, everyday gorotine perfect exit

Select golang is IO operation monitoring, IO operations when it happens, trigger the corresponding action
In each case statement must be a IO operations, precisely, should be a channel of IO operations oriented
5, the context of use
Context is usually translated as Context, it is a more abstract concept, its essence, is the transmission of up and down [up] exists on the lower, the content will be passed to the next, in the language, the program unit is refers to the Goroutine

6, the client how to realize the long connection

Server is set the timeout, the for loop iterates through the
7, the main coroutines how to wait for the rest of the finished coroutines operation

Use the channel for communication, context, select
8, slice, len, cap, expansion and sharing,

Append function, because the slice of the underlying data structure is, by the array, len, cap, so when using append expansion, will check if there is any contiguous memory array behind fast, have added behind, not to generate a large group of
9, the map how to order read

Read the map can't order, because he is disorderly, want to read an orderly, the first of the problem is that the key to orderly, so you can put the key in the slice, prioritize, sliced traversal section, through the key values,
10, to achieve the set

The type system interface {}
Type Set struct {
M map [Intel] bool
Sync. RWMutex
}

Func New () * Set {
Return & amp; The Set {
M: the map [Intel] bool {},
}
}
Func (s * Set) Add (item system) {
S.L ock ()
Defer s.U nlock ()
S.m [items]=true
}
11, the realization of the message queue (more producers, consumers)

Using slice lock can achieve
12, large files sort

Merge sort, divide and conquer, broken down into small files, in order
13, the basic sorting, which is stable
14, HTTP get with head

HEAD and GET the essence is the same, the difference is that the HEAD does not contain data, but merely the HTTP headers, some people may think this method doesn't do anything, it's not like that, imagine a business scenario: to determine whether a resource, we usually use GET, but here in the HEAD, meaning more clear,
15, HTTP 401403

400 bad request, the request message syntax error
401 unauthorized, indicates the request need to be sent via HTTP authentication authentication information
403 who, said the request resources access server rejected
404 not found, said at the server failed to find the requested resource
Keep alive - 16, HTTP

Client sends the HTTP request header need to increase the Connection: keep alive - field
Web Server - side need to be able to identify the Connection: keep alive - field, and specify the Connection in the HTTP response: keep alive - fields, tell the client, I can keep alive - service and "hear" the client I temporarily not close the socket Connection
17, HTTP can a connection request for many times, ranging from the back-end return

Nature of HTTP listed using a socket connection, so send the request, write the TCP buffer, can be repeated, that's why HTTP is a stateless
18, TCP and udp distinction, udp advantages, applicable scenario

TCP transport stream, and udp packet, TCP will into a three-way handshake, udp does not need
19, the role of time - wait

20 and how to build the index database

21, an orphan, zombie process
22, deadlock conditions, how to avoid the
23, Linux command, check the port, CPU load, memory usage, how to send a signal to a process
24, git file version, the use of the order, the merge with rebase

26, Slice and array distinction, Slice the underlying structure
27, WeChat pay for this project, after paying WeChat notice here, received two same WeChat payment notice, how to prevent repeated consumption (similar to the idempotence of the interface), said the use Redis or database transaction
28, the message in the project how to push (business related)
29, Go way how to find the corresponding reflection packages (forget how to ask here, can't speak directly, only DeepEqual, short DeepEqual)

30, Redis basic data structure31, Redis List used? How the underlying implementation? Know but never used, don't know how to achieve
32, Mysql index has several, time complexity
Is 33, InnoDb table locks or row locks, why (why, answer not to come out here just said row locks)
34, Go channel (with and without buffer buffer)
35, exit the program finished, how to prevent the channel no consumption here a bit not clear the interviewer asks at the beginning, and then said the interrupt signal monitoring, do processing for the exit, and then the interviewer said didn't mean it, and said, send before told length, length if you don't know? Close the channel downstream are 0, can use this told the interviewer (there is also a bit don't understand)
36, use any message middleware and such? There is no
37, what's the problem? Evaluation? Followed by interview, later ask

38, producer consumer model, handwritten code (Go directly use the channel implementation is very simple, want to let the interviewer will not also use the channel, not can use an array of channel condition variables), the channel buffer length of how to decide, how to control the upstream production speed too fast, there is no name of solution, can simply said the channel length and a linear relationship with the velocity ratio of upstream and downstream, the interviewer said that this is a kind of solution
39, handwritten circular queue
40, write the circular queue is thread-safe, not, how to ensure the safety of thread lock, efficiency is a bit low, then the interviewer can remind the Go atomic operations and channel
41, write the code behind the interviewer said question answer can, don't know if it doesn't matter
42, Linux will, it will only a few commands, the interviewer said a total has more than one hundred command
43, TimeWait and CloseWait reason
44, segment tree understand? Don't know, dictionary tree? Understand
45, seen what source, NSQ message middleware (Go), simple asked me waitgroup package to prove that I have seen
46, sync. Used the Pool, why use, object pooling, avoid frequent allocating objects (GC), where the object is fixed? Not clear, did not see the source code
47. What's the problem? Evaluation? Foundation is good, Linux is short of, Go understanding is not enough in-depth, advanced data structure does not understand, the advantage is to look at the source code
48, behind the interviewer about the things they do, the main part is advertising, said at least more than millions of average daily volume of data, as many as hundreds of millions of, use Go to support high concurrency, with micro service, service management, said the things I need to learn a lot of

49, proving that binary tree leaf node relationship with degree of 2 node
50, the only index and primary key index
51, smart Pointers
52, string parsing for digital (consider floating-point)

53, single sign-on, TCP packet
54, handwritten shuffle
55, dealing with sticky implementation broken package, the interviewer think be negle algorithm, explains the negle associated with confused window syndrome, and then the interviewer think other projects is crud hasn't asked
56, goroutine scheduling with what the system call, this will not, asked the interviewer want from go operating system, then thought that * * * as system foundation is bad, he asked whether the OS problem
57, virtual space distribution process, where global variables? The answer came up, the operating system will ask
Have 58, network programming, there is, how to see the connection status? Netstat, what? ESTABLISHED, LISTEN, and so on, have any abnormal situation? TIME_WAIT many, why? A large number of short link
59, several basic sorting algorithms, asked a bunch of time complexity, stability, why not stable
60, topk problem, huge amounts of data topk (answer into segmentation loading memory for many times, and then use maintain k length of ordered list, and then is said bad time complexity, prompt or a heap, and then oh oh oh)
Longest continuous string and, here I said solution useless dp (to dp are not ripe), the interviewer always lead me dp, or not
61, what is the primary key
62, united index and the only index
62, the more the better the index?
63, indexing should pay attention to what?
64, processes and threads to distinguish?
65, a deadlock?
In 66, the TCP three-way handshake
In 67, HTTP, HTTPS
In 68, a status code of 401301302201
69, project I said only a computer, so use of standalone deployment, the interviewer said more than single machine also can be deployed, what method? What I said docker, ask docker network, are not ripe, dockerfile keywords, only a few, pulled nginx forward by the way,

70, database isolation level, submit to read what is the
71, go scheduling
72, goroutine leak any processing, set the timeout, select add timers

73, mysql high availability schemes
74, thread process difference between

75, sorting algorithm and time complexity
76, how to learn go
77, go thread, told him with goroutine scheduling
78, IO model, synchronous blocking, synchronization, non-blocking, asynchronous
In 79, the cookie and session

Internship program
The pros and cons
The evaluation of students
Hobbies
What's the offer
80, interface KPS test
81, redis list data structure (leap), query time complexity
82, redis distributed, how to reduce synchronization delay
83, mysql can realize the function of redis
84, how to learn at ordinary times?
85, see what book?
In 86, the interest hobby
Four distributed papers, 87, seen Google did not see
In 89, cap theory, for example,
90, LRU algorithm, LFU
91, something about how to understand the network programming

92, go to use on any pit (for range, database connection defer close)
93, advantages and disadvantages go
95, go the value of the transfer and reference
In 96, slow query
97, why use pg
98, redis data types

99, all left leaf node and
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related