Common basic interview questions in GO language

Due to the rise of the blockchain concept, many companies have begun to increase investment in the field of distributed data storage and decentralization. Now blockchain technology has been widely used in finance, Internet of Things, logistics, public services, digital copyright, insurance and other fields. From the technical development level, the blockchain is mainly based on Go language and C++ language. At present, most of the domestic blockchain development uses the Go language. Therefore, if you want to find a blockchain-related job, you need to master the basic knowledge of the Go language. Here are some common basic interview questions in the Go language.

Blockchain development engineers must apply for a job: common basic interview questions in GO language

1. Talk about the for loop in Go language?

The for loop supports continue and break to control the loop, but it provides a more advanced break, which can choose which loop to interrupt; the
  for loop does not support multiple assignment statements separated by commas. You must use parallel assignment to initialize multiple Variables.

2. Talk about the switch statement in Go language?

In a single case, multiple result options can appear;
  only when the fallthrough keyword is explicitly added to the case, the execution of the next case will continue.
  
  3. There is no hidden this pointer in the Go language. What does this sentence mean?

The object imposed by the method is passed explicitly without being hidden;
  Golang's object-oriented expression is more intuitive, with a different syntax for process-oriented expression;
  the object imposed by the method does not have to be a pointer, nor does it have to be called this.

4. Talk about the main function of the Go language

The main function cannot take parameters; the
  main function cannot define the return value;
  the package where the main function is located must be the main package; the
  flag package can be used in the main function to obtain and parse command line parameters.

5. Talk about synchronization lock in Go language?

(1) When a Goroutine obtains a Mutex, other Goroutines can only wait obediently, unless the Goroutine releases the Mutex.
  (2) RWMutex will prevent writing but not reading when the read lock is occupied.
  (3) RWMutex will prevent any other Goroutine (regardless of reading and writing) from entering when the write lock is occupied, and the entire lock is equivalent to being exclusively owned by the Goroutine.

6. Talk about the channel features of Go language?

A. Send data to a nil channel, causing permanent blocking;
  B. Receiving data from a nil channel, causing permanent blocking;
  C. Send data to a closed channel, causing panic;
  D. Receive data from a closed channel If the buffer is empty, a zero value is returned;
  E. The unbuffered channel is synchronous, and the buffered channel is asynchronous.

7. What are the scenarios where Go language triggers exceptions?

A. Null pointer analysis;
  B. Subscript out of bounds;
  C. Divisor is 0;
  D. Call panic function.

8. Talk about the beeGo framework of Go language?

A. beeGo is a lightweight HTTP framework implemented by Golang;
  B. beeGo can complete url routing injection through various methods such as annotation routing, regular routing, etc.;
  C. You can use the bee new tool to generate an empty project, and then use the bee run command to automatically Hot compilation.

9. Talk about the Goconvey framework of the Go language?

A. Goconvey is a unit testing framework that supports Golang;
  B. Goconvey can automatically monitor file modifications and start tests, and can output test results to the web interface in real time;
  C. Goconvey provides a wealth of assertions to simplify the writing of test cases.

10. What is the role of GoStub in the Go language?

A. GoStub can piling global variables;
  B. GoStub can piling functions;
  C. GoStub cannot piling member methods of classes;
  D. GoStub can piling dynamic stubs. For example, after piling a function, calling the function multiple times will There are different behaviors.

11. Tell me about the select mechanism of Go language?

A. The select mechanism is used to deal with asynchronous IO issues;
  B. The biggest limitation of the select mechanism is that each case statement must be an IO operation;
  C. Golang supports the select keyword at the language level.
  
  For Go language, its syntax is close to C language, but variables and declarations are different. In addition, Go supports garbage collection. Compared with C++, Go does not include functions such as American drama, exception handling, inheritance, generics, assertions, virtual functions, etc., but adds language-level support for features such as slices, concurrency, pipes, garbage collection, and interfaces. At the same time, the development of Go language in China has a short period of time. For novices, learning the Go language to enter a blockchain development position is a good choice. The above is the common basic interview in Go language that is necessary for the job search of blockchain development engineers. Have you got it?

Guess you like

Origin blog.csdn.net/JACK_SUJAVA/article/details/108627651