Courses
Go for Beginners: Write Reliable Programs and Small Services
Check Yourself
Five scenario questions on slice capacity, nil maps, comma-ok lookups, and pointer receivers.
Course content
Join this Course
Sign in to save your progress.
-
Before You Write Code
-
Why Go Exists and When to Pick It
-
Run Your First Go Program
-
-
-
Values, Control Flow, and Functions
-
Variables, Types, and Zero Values
-
If, For Loops, and Multiple Return Values
-
-
-
Slices, Maps, and Structs
-
Arrays, Slices, and Why append Matters
-
Maps, Structs, and Pointer Receivers
-
-
-
Errors, Packages, and Testing
-
Handle Errors Without Hiding Them
-
Packages, Exports, and go test
-
-
-
Files, JSON, and a Small HTTP Server
-
Read Files and Decode JSON Structs
-
Build and Test a Small net/http Server
-
-
-
Pointers, Modules, and CLIs
-
Pointers and Memory Basics
-
Managing Dependencies and internal/ Packages
-
Building CLIs With flag, os.Getenv, and Exit Codes
-
-
1.
You create `s := make([]int, 2, 4)` and run `t := append(s, 99); t[0] = 777`. What is `s[0]` now?
2.
You declare `var counts map[string]int` and immediately run `counts["hits"] = 1`. What happens?
3.
A map `scores := map[string]int{"ben": 0}` holds 0 for "ben" and has no entry for "carla". How do you tell them apart?
4.
You write `func (c Counter) Inc() { c.Value++ }` and call `c.Inc()`. Why is `c.Value` still 0 afterward?
5.
Which declaration gives you an empty string slice that is ready for len(), range, and append() with zero upfront allocation?
About
Five scenario questions on slice capacity, nil maps, comma-ok lookups, and pointer receivers.
- Duration
- 5 min
- Last update
- 11/27/2026
Was this helpful?
0
0
Comments
Sign in to commentNo comments yet.