All question banksProgramming Languages
Go 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.
1. What is Go? What are its key features? Beginner 2. What are the advantages of Go over other languages? Beginner 3. What is the difference between Go and other languages like Java/Python/C++? Intermediate 4. What is a package in Go? What is the main package? Beginner 5. What is the difference between var, :=, and const? Beginner 6. What are the basic data types in Go? Beginner 7. What is a zero value in Go? Beginner 8. What is type inference in Go? Beginner 9. What is the difference between new and make? Intermediate 10. What is the blank identifier _ used for? Beginner 11. What is the difference between functions and methods in Go? Intermediate 12. What are variadic functions? Intermediate 13. Can Go functions return multiple values? Beginner 14. What are named return values? Intermediate 15. What are defer statements? How do they work? Intermediate 16. What is the execution order of multiple defer statements? Intermediate 17. What are first-class functions and closures in Go? Advanced 18. What is function recursion in Go? Beginner 19. What are pointers in Go? Beginner 20. What is the difference between passing by value and passing by pointer? Intermediate 21. Can you do pointer arithmetic in Go? Advanced 22. What is a nil pointer? Beginner 23. When should you use pointers vs values? Advanced 24. What is the difference between arrays and slices? Beginner 25. How do slices work internally? What is backing array? Advanced 26. What are the len() and cap() functions for slices? Intermediate 27. What is slice append operation? How does it affect capacity? Intermediate 28. What is slice re-slicing? Intermediate 29. What are maps in Go? How do they work? Intermediate 30. How do you check if a key exists in a map? Beginner 31. Are maps thread-safe in Go? Advanced 32. What is a struct in Go? Beginner 33. What are struct tags? Where are they used? Intermediate 34. What is struct embedding (composition)? Advanced 35. What is the difference between named and anonymous structs? Intermediate 36. What are interfaces in Go? Intermediate 37. What is the empty interface interface{}? Intermediate 38. How does interface implementation work in Go (implicit vs explicit)? Advanced 39. What is type assertion in Go? Intermediate 40. What is type switch? Intermediate 41. What is the difference between interface{} and any? Beginner 42. What are method receivers (value vs pointer receivers)? Advanced 43. What are goroutines? Beginner 44. How do you create a goroutine? Beginner 45. What is the difference between goroutines and threads? Advanced 46. What are channels in Go? Intermediate 47. What is the difference between buffered and unbuffered channels? Advanced 48. How do you close a channel? What happens when you close it? Intermediate 49. What is a deadlock in Go? Intermediate 50. What is the select statement? Advanced 51. What is channel direction (send-only, receive-only)? Intermediate 52. What are WaitGroups? When do you use them? Intermediate 53. What is a Mutex? What is RWMutex? Intermediate 54. What is the difference between Mutex and RWMutex? Advanced 55. What is a race condition? How do you detect it? Intermediate 56. What is the sync.Once type? Intermediate 57. What is the sync.Pool? Advanced 58. What is the difference between concurrency and parallelism? Advanced 59. What is runtime.GOMAXPROCS()? Advanced 60. What are worker pools in Go? Intermediate 61. How does error handling work in Go? Beginner 62. What is the error interface? Beginner 63. How do you create custom errors? Intermediate 64. What is errors.New() vs fmt.Errorf()? Beginner 65. What is error wrapping (Go 1.13+)? Intermediate 66. What are errors.Is() and errors.As()? Advanced 67. Does Go have exceptions? Why not? Intermediate 68. What is a Go module? Beginner 69. What is go.mod and go.sum file? Intermediate 70. What is the difference between package and module? Intermediate 71. What are exported and unexported identifiers? Beginner 72. What is the init() function? Intermediate 73. What is the execution order of init() functions? Advanced 74. What is the context package? Intermediate 75. What are the types of contexts (WithCancel, WithTimeout, WithDeadline, WithValue)? Advanced 76. Why should you pass context as the first parameter? Intermediate 77. When should you use context.TODO() vs context.Background()? Intermediate 78. How does garbage collection work in Go? Advanced 79. What is escape analysis in Go? Advanced 80. What is the difference between stack and heap allocation? Intermediate 81. How do you prevent memory leaks in Go? Advanced 82. What is the runtime package used for? Intermediate 83. What are finalizers in Go? Advanced 84. How do you write unit tests in Go? Beginner 85. What is the naming convention for test files and functions? Beginner 86. What is table-driven testing? Intermediate 87. What is benchmarking in Go? Intermediate 88. What is the testing.T and testing.B? Intermediate 89. How do you check test coverage? Intermediate 90. What are reflection in Go? When to use it? Advanced 91. What is the reflect package? Advanced 92. What is empty struct struct{}? Why use it? Intermediate 93. What is the difference between panic and recover? Advanced 94. When should you use panic? Intermediate 95. What are build tags/constraints? Advanced 96. What is CGO? When do you use it? Advanced 97. What are go routines leaks? How to prevent them? Advanced 98. What is the difference between sync.Map and regular map? Advanced 99. What are atomic operations in Go? Advanced 100. What is the unsafe package? Should you use it? Advanced