Go interview questions

Goroutines and channels, error handling, interfaces, slices, context and concurrency bugs.

Readiness: 0 of 9 nailed

How to use this page: 1. Read a question2. Type your answer3. Check with AI4. Open the model answer5. Timed drill when you’re 70% ready

Concurrency

JuniorConcept

What are goroutines and channels?

Mid-levelIt’s broken: why?

A counter updated by 100 goroutines ends up below 100. Why, and how do you detect it?

Mid-levelConcept

What is context.Context for?

Mid-levelIt’s broken: why?

Your Go service crashes with fatal error: concurrent map writes. Why?

Basics

FoundationConcept

How does error handling work in Go?

Mid-levelPredict the output

What does this print?

a := []int{1, 2, 3}
b := a[:2]
b = append(b, 99)
fmt.Println(a)
JuniorConcept

How are interfaces different in Go?

JuniorPredict the output

What does this print?

func main() {
  for i := 1; i <= 3; i++ {
    defer fmt.Print(i, " ")
  }
}

Web

JuniorWrite it by hand

Write a minimal JSON HTTP handler in Go.

Also prepare