Go skill check
Check your Go: slices, maps, interfaces, error handling, defer, goroutines, and channels, with short programs where you predict the output or the deadlock.
15
Questions
14 min
Timer can't pause
Multiple choice
Go 1.22
Choose a level
Question type
Topics
- Types and zero values
- Slices and maps
- Structs and methods
- Interfaces
- Errors
- Goroutines
- Channels
- Defer and panic
Do
Use scratch paper or a notepad to work things out. Skip a question and come back to it later.
Don't
Run the code or look up answers during the check. Open the check in more than one tab or window.
Easy · Mixed · 15 questions · 14 min
By starting, you agree to the Terms and Privacy Policy.
Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.
Checking your levels…
Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.
Sample Go questions with answers
These are never used in a check, so seeing their answers here won't give anything away.
Question 1 · Easy · Types and zero values
In Go, what is the default zero value of an uninitialized variable declared with the typeerror?- A.
nil - B.An empty string ""
- C.
A pointer to errors.New("") - D.A non-nil struct with an empty message
Show answer
A.
nilBecauseerroris an interface type in Go, its zero value isnil.- A.
Question 2 · Easy · Slices and maps
What happens when you look up a non-existent key in an initialized Go map using the single-value assignment syntax, such asval := m["missing"]?- A.The program produces a compile-time error.
- B.The runtime panics with a KeyError.
- C.It returns the zero value of the map's value type.
- D.The runtime returns nil regardless of the value type.
Show answer
C. It returns the zero value of the map's value type.
In Go, retrieving a missing key returns the zero value of the value element type without panicking.Question 3 · Moderate · Structs and methods
When a type T embeds an unexported struct field of type u, which statement correctly describes method promotion?- A.Methods of u are promoted only if T implements an explicit interface that requires them.
- B.Exported methods of u are promoted, but their names are automatically lowercased on T.
- C.Exported methods of u are promoted to T and become part of T's exported method set.
- D.No methods of u are promoted because the embedded field type itself is unexported.
Show answer
C. Exported methods of u are promoted to T and become part of T's exported method set.
In Go, methods of an embedded struct type are promoted regardless of whether the embedded type's identifier is exported or unexported, provided the method itself is exported.Question 4 · Advanced · Interfaces
In the standard 64-bit Go runtime, what internal data structure represents a non-empty interface (an interface with methods, e.g.,io.Reader)?- A.A single 8-byte pointer directly to the struct instance with methods resolved through a global lookup table.
- B.An 8-byte pointer to an
efacestruct that holds only the concrete runtime type descriptor. - C.A 16-byte
ifacestruct containing a pointer to anitaband a pointer to the underlying data. - D.A 24-byte struct containing a type descriptor pointer, a method offset table, and an inline data buffer.
Show answer
C. A 16-byte
ifacestruct containing a pointer to anitaband a pointer to the underlying data.In the Go runtime, non-empty interfaces are represented byiface, which consists of two 8-byte words: a pointer to theitab(holding the interface type, concrete type, and function pointers for the interface methods) and anunsafe.Pointerto the data.
How scoring and certificates work
- Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
- Practice is free without an account and shows whether each answer is right as you go, with an explanation.
- The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
- Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.