• что такое строки в go? • как можно посчитать количество символов строке ? • какой есть способ в go быстро складывать строки? • что такое каналы, в чем различия между буфферизированным и не буфферизированным каналом? • что такое пакет sync? какие есть там примитивы и для чего? • расскажи про gmp модель • как устроен map в go? • какой порядок обхода в map? • за счет чего в go быстрые http запросы? как он исполняется?
-
-
Save sshaplygin/ef09bf18b830e7bf0ba690d0cde5ea3d to your computer and use it in GitHub Desktop.
Interview test task for Go developer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| fmt.Println(len("Женёк")) // ?? | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| digits := []int{1, 2, 3, 4, 5} | |
| for _, d := range digits { | |
| defer println(d) // ??? | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| func main() { | |
| ch := make(chan int) | |
| for i := 0; i < 10; i++ { | |
| select { | |
| case x := <-ch: | |
| println(x) // ??? | |
| case ch <- i: | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| // Напиши свою реализацию sync.Once, то есть объекта, который выполнит только один раз некое действие. | |
| // TODO | |
| func init() { | |
| ch := make(chan int) | |
| f := func() { | |
| close(ch) | |
| } | |
| o := NewMyOnce() | |
| o.Do(f) | |
| o.Do(f) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| func main() { | |
| c0 := make(chan int) | |
| c1 := make(chan int) | |
| r := merge(c0, c1) | |
| c0 <- 1 | |
| c1 <- 0 | |
| println(<-r) | |
| println(<-r) | |
| } | |
| func merge(chs ...chan int) chan int { | |
| // TODO | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Получите все магазины с количеством заказов за сентябрь больше 100 | |
| CREATE TABLE orders | |
| ( | |
| id integer primary key not null, // - | |
| sum integer not null, | |
| user_id integer not null, | |
| shop_id integer not null, | |
| created_at timestamptz not null, | |
| updated_at timestamptz not null // | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment