Loading…
40+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes arrays vs slices, slice internals len cap, append and growth, slice tricks, and more.
Suggested path
Topics follow a teaching order. Each answer ends with a clear Next question control so you can move forward without hunting the list.
Slices and maps are the workhorse data structures in Go, and the interview questions around them test whether you understand what's happening under the hood. This module covers the array vs slice distinction (arrays have fixed length at compile time and are value types; slices are descriptors pointing to an underlying array), the three-field slice header (pointer, len, cap), append and what happens when capacity is exceeded (a new, larger array is allocated and the slice descriptor is updated — why this means append can return a different backing array), the common slice tricks (copy, delete element by index, two-pointer for filter-in-place), maps with make and map literals, map zero values (reading a missing key returns the zero value; writing to a nil map panics — the check-existence idiom: v, ok := m[k]), safe concurrent map access (sync.Map or map + Mutex), and ranging over slices and maps. Every answer includes the gotcha the interviewer is testing.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–40 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–40 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q40.