Skip to content
codinganthem

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

About 40% code reading

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.

Start practice

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.

  1. Question 1 · Easy · Types and zero values

    In Go, what is the default zero value of an uninitialized variable declared with the type error?
    1. A.nil
    2. B.An empty string ""
    3. C.A pointer to errors.New("")
    4. D.A non-nil struct with an empty message
    Show answer

    A. nil

    Because error is an interface type in Go, its zero value is nil.
  2. 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 as val := m["missing"]?
    1. A.The program produces a compile-time error.
    2. B.The runtime panics with a KeyError.
    3. C.It returns the zero value of the map's value type.
    4. 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.
  3. Question 3 · Moderate · Structs and methods

    When a type T embeds an unexported struct field of type u, which statement correctly describes method promotion?
    1. A.Methods of u are promoted only if T implements an explicit interface that requires them.
    2. B.Exported methods of u are promoted, but their names are automatically lowercased on T.
    3. C.Exported methods of u are promoted to T and become part of T's exported method set.
    4. 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.
  4. 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)?
    1. A.A single 8-byte pointer directly to the struct instance with methods resolved through a global lookup table.
    2. B.An 8-byte pointer to an eface struct that holds only the concrete runtime type descriptor.
    3. C.A 16-byte iface struct containing a pointer to an itab and a pointer to the underlying data.
    4. 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 iface struct containing a pointer to an itab and a pointer to the underlying data.

    In the Go runtime, non-empty interfaces are represented by iface, which consists of two 8-byte words: a pointer to the itab (holding the interface type, concrete type, and function pointers for the interface methods) and an unsafe.Pointer to 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.