PRACTICE / UNDERSTAND / REPEAT

Go MCQ Practice

Reason about Go slices, maps, pointers, interfaces, channels, and control flow.

320 questionsAnswers explainedFree · no login

Put your knowledge to the test.

A random set of up to 10 questions from Go. Your answers stay on this page.

Choose a topic

Try a few questions

Open a topic above to explore the complete question bank.

01 / Declarations · MCQQuestion link ↗

Inside a function, which operator declares and initializes `count`?

Choose one answer
Answer & explanation

Answer: :=

Go’s short declaration operator is `:=`; plain `=` assigns to an already-declared variable.

02 / Slices · MCQQuestion link ↗

Which built-in function appends an element to a slice?

Choose one answer
Answer & explanation

Answer: append

`append(slice, value)` returns the updated slice and may allocate a larger backing array.

03 / Errors · MCQQuestion link ↗

What is the conventional Go error check after a function returns `err`?

Choose one answer
Answer & explanation

Answer: if err != nil { return err }

Go represents errors as values; callers commonly compare the returned error with `nil`.

04 / Concurrency · MCQQuestion link ↗

Which keyword starts a goroutine?

Choose one answer
Answer & explanation

Answer: go

The `go` statement invokes a function concurrently in a new goroutine.

05 / Maps · MCQQuestion link ↗

What happens when you read a missing key from a Go map?

Choose one answer
Answer & explanation

Answer: You get the element type’s zero value

A map lookup returns the zero value when absent; the comma-ok form distinguishes absent keys.

06 / Functions · Code recallQuestion link ↗

Complete the keyword that declares this Go function.

___ greet(name string) {
    fmt.Println(name)
}
Answer & explanation

Answer: func

`func` declares a Go function.