All Projects → proghub-official → golang-interview

proghub-official / golang-interview

Licence: other
⁉️ Вопросы для собеседования по Go

Projects that are alternatives of or similar to golang-interview

FAANG-Coding-Interview-Questions
A curated List of Coding Questions Asked in FAANG Interviews
Stars: ✭ 1,195 (+2198.08%)
Mutual labels:  interview, interview-questions
CRACK JS INTERVIEWS
CRACK JS INTERVIEW
Stars: ✭ 33 (-36.54%)
Mutual labels:  interview, interview-questions
Algorithmic-Problem-Solving
Solutions of algorithmic type of programming problems from sites like LeetCode.com, HackerRank.com, LeetCode.com, Codility.com, CodeForces.com, etc. using Java.
Stars: ✭ 20 (-61.54%)
Mutual labels:  interview, interview-questions
flutter interview
Flutter面试题和答案收集,各种知识点的深入研究,学完之后征服你的面试官。
Stars: ✭ 249 (+378.85%)
Mutual labels:  interview, interview-questions
Grokking-the-Coding-Interview-Patterns-for-Coding-Questions
Grokking the Coding Interview: Patterns for Coding Questions Alternative
Stars: ✭ 374 (+619.23%)
Mutual labels:  interview, interview-questions
interview-questions
Популярные HTML / CSS / JavaScript / ECMAScript / TypeScript / React / Vue / Angular / Node вопросы на интервью и ответы на них (https://tinyurl.com/wxysrpsy)
Stars: ✭ 3,294 (+6234.62%)
Mutual labels:  interview, interview-questions
Front-end-Job-Interview-Questions
Ответы на вопросы на должность Frontend разработчика.
Stars: ✭ 236 (+353.85%)
Mutual labels:  interview, interview-questions
reverse-interview-zh-tw
📖 reverse-interview 繁體中文翻譯計畫。原作者:https://github.com/viraptor/reverse-interview
Stars: ✭ 313 (+501.92%)
Mutual labels:  interview, interview-questions
reactjs-persian-interview-questions
مجموعه برترین سوال و جواب‌های ری‌اکت(احتمالا برای استخدام اینا)
Stars: ✭ 323 (+521.15%)
Mutual labels:  interview, interview-questions
codewars python solutions
My CodeWars solutions in Python.
Stars: ✭ 111 (+113.46%)
Mutual labels:  interview, interview-questions
SecurityInterviewGuide
网络信息安全从业者面试指南
Stars: ✭ 791 (+1421.15%)
Mutual labels:  interview, interview-questions
one-note-a-day
编程每日一题:每天一道精选面试或编程题,180秒内语音答题模式凝练答案。次日推送标准参考答案至群内供大家复盘,做到事事有回音,题题有答案。
Stars: ✭ 70 (+34.62%)
Mutual labels:  interview, interview-questions
Test-Bank
Interview preparation and practice problems
Stars: ✭ 43 (-17.31%)
Mutual labels:  interview, interview-questions
pw
Best websites a Programmer should visit
Stars: ✭ 27 (-48.08%)
Mutual labels:  interview, interview-questions
CS Offer
后台开发基础知识总结(春招/秋招)
Stars: ✭ 352 (+576.92%)
Mutual labels:  interview, interview-questions
Data-Structure-Algorithms-LLD-HLD
A Data Structure Algorithms Low Level Design and High Level Design collection of resources.
Stars: ✭ 922 (+1673.08%)
Mutual labels:  interview, interview-questions
CPPNotes
【C++ 面试 + C++ 学习指南】 一份涵盖大部分 C++ 程序员所需要掌握的核心知识。
Stars: ✭ 557 (+971.15%)
Mutual labels:  interview, interview-questions
CsharpInterviewQuestions
A C# code collection of Interview Questions
Stars: ✭ 62 (+19.23%)
Mutual labels:  interview, interview-questions
reverse-interview-zh
技术面试最后反问面试官的话
Stars: ✭ 15,141 (+29017.31%)
Mutual labels:  interview, interview-questions
Awesome-Software-Engineering-Interview
No description or website provided.
Stars: ✭ 409 (+686.54%)
Mutual labels:  interview, interview-questions

Вопросы для собеседования по Go

ℹ️ В этом репозитории содержаться вопросы и ответы с помощью которых вы можете подготовиться к собеседованию по Golang

📱 Telegram-канал - @golangquiz

📊 Вопросов - 14.

📝 Вы можете добавить свой вопрос или обьяснение, исправить/дополнить существующий с помощью пул реквеста :)

Todo:

  • разделить вопросы по категориям
  • разделить вопросы по сложности

Список вопросов и ответов

1. Какие основные фичи GO?
  • Сильная статическая типизация - тип переменных не может быть изменен с течением времени, и они должны быть определены во время компиляции
  • Быстрое время компиляции
  • Встроенная конкурентность
  • Встроеный сборщик мусора
  • Компилируется в один бинарник - все, что вам нужно для запуска приложения. Очень полезно для управления версиями во время выполнения.
2. Что выведет код?
package main
 
import (
	"fmt"
	"sync"
	"time"
)
 
func main() {
	var wg sync.WaitGroup
	
	wg.Add(1)
	go func() {
		time.Sleep(time.Second * 2)
		fmt.Println("1")
		wg.Done()
	}()

	go func() {
		fmt.Println("2")
	}()

	wg.Wait()
	fmt.Println("3")
}
Ответ
всегда 2 1 3
3. Что выведет код?
package main

import (
	"context"
	"fmt"
	"time"
)

func main() {
	timeout := 3 * time.Second
	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()

	select {
	case <-time.After(1 * time.Second):
		fmt.Println("waited for 1 sec")
	case <-time.After(2 * time.Second):
		fmt.Println("waited for 2 sec")
	case <-time.After(3 * time.Second):
		fmt.Println("waited for 3 sec")
	case <-ctx.Done():
		fmt.Println(ctx.Err())
	}
}
Ответ
waited for 1 sec
4. Что выведет код?
package main

import (
	"container/heap"
	"fmt"
)

type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func main() {
	h := &IntHeap{2, 1, 5}
	heap.Init(h)
	fmt.Printf("first: %d\n", (*h)[0])
}
Ответ
first: 1
5. Что выведет код?
package main

import (
	"fmt"
)

func mod(a []int) {
	// Как и почему изменится вывод если раскомментировать строку ниже?
	// a = append(a, 125)
	
	for i := range a {
		a[i] = 5
	}
	
	fmt.Println(a)
}

func main() {
	sl := []int{1, 2, 3, 4}
	mod(sl)
	fmt.Println(sl)
}
Ответ
[5 5 5 5]
[5 5 5 5]
если раскомментировать `a = append(a, 125)`
[5 5 5 5 5]
[1 2 3 4]
6. Что выведет код? (тема - defer)
package main

import (
	"fmt"
)

func main() {
	i := 0
	defer fmt.Println(i)
	i++
	return
}
Ответ
0
7. Что выведет код? (тема - defer)
package main

import (
	"fmt"
)

func main() {
	for i := 0; i < 5; i++ {
		defer func(i *int) {
			fmt.Printf("%v ", *i)
		}(&i)
	}

}
Ответ
5 5 5 5 5
8. Предположим, что x объявлен, а y не объявлен, какие пункты ниже верны?
x, _ := f()
x, _ = f()
x, y := f()
x, y = f()
Ответ
x, _ = f()
x, y := f()
9. Что делает runtime.newobject()?

Выделяет память в куче. https://golang.org/pkg/runtime/?m=all#newobject

10. Что такое $GOROOT и $GOPATH?

$GOROOT каталог для стандартной библиотеки, включая исполняемые файлы и исходный код.
$GOPATH каталго для внешних пакетов.

11. Что выведет код? (тема - slice)
package main

import (
	"fmt"
)

func main() {
	test1 := []int{1, 2, 3, 4, 5}
	test1 = test1[:3]
	test2 := test1[3:]
	fmt.Println(test2[:2])
}
Ответ
[4 5]
12. Перечислите функции которые могу остановить выполнение текущей горутины

runtime.Gosched
runtime.gopark
runtime.notesleep
runtime.Goexit

13. Что выведет код?
x := []int{1, 2}
y := []int{3, 4}
ref := x
x = y
fmt.Println(x, y, ref)
Ответ
[3 4] [3 4] [1 2]
14. Как скопировать slice?

Следует воспользоваться встроенной функцией copy:

x := []int{1, 2}
y := []int{3, 4}
ref := x
copy(x, y)
fmt.Println(x, y, ref)
// Output: [3 4] [3 4] [3 4]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].