Top 100 Most Asked Go (Golang) Interview Questions

A comprehensive collection of Go interview questions covering language syntax, concurrency primitives, memory management, and idiomatic patterns. Designed for technical screenings and deep-dives.

0%

Overall Progress

0/100

1.What is Go? What are its key features?

2.What are the advantages of Go over other languages?

3.What is the difference between Go and other languages like Java/Python/C++?

4.What is a package in Go? What is the main package?

5.What is the difference between var, :=, and const?

6.What are the basic data types in Go?

7.What is a zero value in Go?

8.What is type inference in Go?

9.What is the difference between new and make?

10.What is the blank identifier _ used for?

11.What is the difference between functions and methods in Go?

12.What are variadic functions?

13.Can Go functions return multiple values?

14.What are named return values?

15.What are defer statements? How do they work?

16.What is the execution order of multiple defer statements?

17.What are first-class functions and closures in Go?

18.What is function recursion in Go?

19.What are pointers in Go?

20.What is the difference between passing by value and passing by pointer?

21.Can you do pointer arithmetic in Go?

22.What is a nil pointer?

23.When should you use pointers vs values?

24.What is the difference between arrays and slices?

25.How do slices work internally? What is backing array?

26.What are the len() and cap() functions for slices?

27.What is slice append operation? How does it affect capacity?

28.What is slice re-slicing?

29.What are maps in Go? How do they work?

30.How do you check if a key exists in a map?

31.Are maps thread-safe in Go?

32.What is a struct in Go?

33.What are struct tags? Where are they used?

34.What is struct embedding (composition)?

35.What is the difference between named and anonymous structs?

36.What are interfaces in Go?

37.What is the empty interface interface{}?

38.How does interface implementation work in Go (implicit vs explicit)?

39.What is type assertion in Go?

40.What is type switch?

41.What is the difference between interface{} and any?

42.What are method receivers (value vs pointer receivers)?

43.What are goroutines?

44.How do you create a goroutine?

45.What is the difference between goroutines and threads?

46.What are channels in Go?

47.What is the difference between buffered and unbuffered channels?

48.How do you close a channel? What happens when you close it?

49.What is a deadlock in Go?

50.What is the select statement?

51.What is channel direction (send-only, receive-only)?

52.What are WaitGroups? When do you use them?

53.What is a Mutex? What is RWMutex?

54.What is the difference between Mutex and RWMutex?

55.What is a race condition? How do you detect it?

56.What is the sync.Once type?

57.What is the sync.Pool?

58.What is the difference between concurrency and parallelism?

59.What is runtime.GOMAXPROCS()?

60.What are worker pools in Go?

61.How does error handling work in Go?

62.What is the error interface?

63.How do you create custom errors?

64.What is errors.New() vs fmt.Errorf()?

65.What is error wrapping (Go 1.13+)?

66.What are errors.Is() and errors.As()?

67.Does Go have exceptions? Why not?

68.What is a Go module?

69.What is go.mod and go.sum file?

70.What is the difference between package and module?

71.What are exported and unexported identifiers?

72.What is the init() function?

73.What is the execution order of init() functions?

74.What is the context package?

75.What are the types of contexts (WithCancel, WithTimeout, WithDeadline, WithValue)?

76.Why should you pass context as the first parameter?

77.When should you use context.TODO() vs context.Background()?

78.How does garbage collection work in Go?

79.What is escape analysis in Go?

80.What is the difference between stack and heap allocation?

81.How do you prevent memory leaks in Go?

82.What is the runtime package used for?

83.What are finalizers in Go?

84.How do you write unit tests in Go?

85.What is the naming convention for test files and functions?

86.What is table-driven testing?

87.What is benchmarking in Go?

88.What is the testing.T and testing.B?

89.How do you check test coverage?

90.What are reflection in Go? When to use it?

91.What is the reflect package?

92.What is empty struct struct{}? Why use it?

93.What is the difference between panic and recover?

94.When should you use panic?

95.What are build tags/constraints?

96.What is CGO? When do you use it?

97.What are go routines leaks? How to prevent them?

98.What is the difference between sync.Map and regular map?

99.What are atomic operations in Go?

100.What is the unsafe package? Should you use it?