---
title: "Go: Programming Fundamentals & Concurrency"
description: "Go runs much of the cloud-native toolchain. Test your knowledge on Go syntax, types, and concurrency patterns."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/quizzes/post/golang-programming-fundamentals-quiz
---

# Go: Programming Fundamentals & Concurrency

Welcome to the Go (Golang) Basics Quiz! Most modern infrastructure tooling is written in Go, largely because of its compiled performance and built-in concurrency. This quiz will test your understanding of how Go works, from its strict type system to its "Goroutine" model. Good luck!

## Questions

### 1. What is a "Goroutine" in Go?

- A heavy-weight operating system thread
- A lightweight thread managed by the Go runtime
- A background process isolated by the kernel
- A virtual machine instance for Go binaries

**Hint:** Lightweight execution.

### 2. Which keyword is used to start a Goroutine?

- spawn
- go
- thread
- async

**Hint:** Two letters.

### 3. What is a "Channel" in Go?

- A global variable shared across all threads
- A pipe used to communicate between goroutines
- A network socket for inter-process requests
- A memory buffer for storing compiled bytecode

**Hint:** Communication between goroutines.

### 4. How do you declare a variable with "short-hand" syntax in Go?

- var x = 10
- x := 10
- x = 10
- decl x 10

**Hint:** Infers the type automatically.

### 5. What is the default value (Zero Value) of an integer in Go?

- nil
- 0
- -1
- undefined

**Hint:** Empty state.

### 6. What does "Strictly Typed" mean for Go?

- Variables can change types during runtime
- The compiler forbids mixing incompatible types
- All variables must be declared as global
- Type inference is disabled for all declarations

**Hint:** Can you mix ints and strings?

### 7. What is a "Slice" in Go?

- A fixed-size array defined at compile time
- A dynamic, flexible view into an underlying array
- A memory pointer to a single heap integer
- A reserved keyword for deleting map elements

**Hint:** A flexible array.

### 8. What is the purpose of the `defer` keyword?

- To terminate the program with an error code
- To delay a function call until the caller returns
- To run a function in a separate background thread
- To bypass error checking in the current scope

**Hint:** Execute at the end.

### 9. How does Go handle errors?

- Using nested try/catch/finally blocks
- By returning an error as a secondary return value
- By throwing exceptions to a global handler
- By using pointer offsets to signal failures

**Hint:** No try/catch.

### 10. What is an "Interface" in Go?

- A class template for inheritance hierarchies
- A type that defines a set of method signatures
- A structural layout for binary data storage
- A private package for internal library logic

**Hint:** A set of method signatures.

### 11. What is "Go Modules" (go.mod)?

- A repository for hosting open-source binaries
- The standard system for managing dependencies
- A compiler flag for enabling experimental features
- A specific data type for modular arithmetic

**Hint:** Dependency management.

### 12. What does the `range` keyword do in a loop?

- Defines the start and end indices of an array
- Iterates over elements in various data structures
- Allocates a specific range of memory addresses
- Filters a collection based on a logical condition

**Hint:** Iterating over collections.

### 13. What is a "Map" in Go?

- A sorted list of unique memory addresses
- An unordered collection of key-value pairs
- A visualization tool for function call graphs
- A type of function that transforms slice data

**Hint:** Key-value pairs.

### 14. Which command compiles and runs a Go file in one step?

- `go build` 
- `go run` 
- `go compile` 
- `go start` 

**Hint:** Fast development.

### 15. What is a "Struct" in Go?

- A conditional statement for complex branching
- A collection of fields grouped as a custom type
- A method for organizing files in a directory
- A primitive type used for concurrent messaging

**Hint:** Grouping different types.

### 16. What is a "Pointer" in Go?

- A numeric index used for accessing slice data
- A variable that stores a memory address
- A reference to a specific object interface
- A unique identifier for a running goroutine

**Hint:** Memory address.

### 17. What is the "Main" package in Go?

- The default library containing core functions
- The package that defines an executable program
- A reserved package for handling system interrupts
- The root directory of a Go workspace

**Hint:** Entry point.

### 18. What is the purpose of the `select` statement?

- To filter data from a database query result
- To wait on multiple channel operations
- To choose between multiple struct implementations
- To allocate a block of memory for a new map

**Hint:** Switch for channels.

### 19. How do you export a function from a Go package?

- Declare the function with the `pub` keyword
- Capitalize the first letter of the function name
- Add an @export annotation above the function
- Move the function into an external header file

**Hint:** Naming convention.

### 20. What is "Panic" in Go?

- A low-level warning logged to the console
- A function that halts normal execution flow
- A performance optimization for tight loops
- A reserved word for naming custom error types

**Hint:** Fatal error.

### 21. What is the purpose of `init()` function?

- To allocate the initial stack for a goroutine
- To run setup logic before the main function
- To reset all global variables to their zero value
- To register the application with the OS kernel

**Hint:** Automatic setup.

### 22. What is a "Buffered Channel"?

- A channel that encrypts data during transit
- A channel with a queue for holding values
- A channel restricted to a single data type
- A channel that automatically closes after use

**Hint:** Capacity without a receiver.

### 23. What is `nil` in Go?

- A constant representing the integer value 0
- The zero value for pointers and interfaces
- A keyword used to delete variables from memory
- A type of error that indicates a successful run

**Hint:** The null value.

### 24. What is "Gofmt"?

- A compiler tool for generating documentation
- A tool that enforces a standard code style
- A framework for building unit tests in Go
- A library for converting Go types to JSON

**Hint:** Standard formatting.

### 25. What is a "Method" in Go?

- A mathematical function for complex logic
- A function with a defined receiver argument
- A way to organize packages in a module
- A built-in type for storing function pointers

**Hint:** Functions with a receiver.

### 26. What is the purpose of `const`?

- To declare a variable with a global scope
- To declare an immutable value at compile time
- To optimize a variable for concurrent access
- To assign a default value to a struct field

**Hint:** Unchanging values.

### 27. What is a "Deadlock" in Go Concurrency?

- A security mechanism that prevents data leaks
- A state where goroutines wait on each other
- A fatal crash caused by accessing nil pointers
- When a network connection is dropped by the host

**Hint:** Stuck forever.

### 28. What is the "Blank Identifier" (_)?

- A variable used to store temporary integers
- An identifier used to discard unwanted values
- A prefix used for declaring private constants
- A special marker for end-of-file characters

**Hint:** Ignoring values.

### 29. What is a "Map Literal"?

- A serialized string representation of a map
- A way to initialize a map with data directly
- A documentation comment explaining map usage
- A validation rule for map key requirements

**Hint:** Direct initialization.

### 30. What is "Go Doc"?

- A health check utility for Go installations
- A tool that generates documentation from code
- A standard library for handling PDF files
- A naming convention for Go project folders

**Hint:** Documentation tool.
