Skip to content

Go Basics Practice (Interactive)

Intuition

Learning through practice: Practice problems are like training drills — they help you apply knowledge and identify areas that need more study.

Why it matters: Regular practice builds confidence and reveals patterns in how concepts are tested. Each problem reinforces key programming concepts.

The key insight: Making mistakes during practice is valuable — each error points to a concept that needs clarification.

Go — Basics Practice

8 auto-graded practice problems covering core Go concepts. Select an answer, submit, and review the explanation.


Types


Functions


Control Flow


Error Handling

Cross-References

Common Mistakes

Forgetting that defer arguments are evaluated immediately: In defer fmt.Println(x), x is evaluated at the defer statement, not when the deferred call runs. Use a closure defer func() { fmt.Println(x) }() to capture the current value.

Using select without a default case: A select with no ready cases and no default blocks forever. Always include a default if you need non-blocking channel operations.

Ignoring errors from functions that return them: Go functions return errors explicitly. Forgetting to check if err != nil causes silent failures and makes debugging difficult.