1. Go Basics (Syntax & Fundamentals)
- What are the key features of Go?
- How is Go different from other programming languages like Python or Java?
- How do you declare variables in Go?
- What are the different data types in Go?
- What is the difference between
varand:=in Go? - What is a constant in Go, and how do you declare it?
- How does Go handle type inference?
- What is the zero value in Go?
- What is the
iotakeyword in Go? - How do you perform string concatenation in Go?
2. Control Structures & Flow
- What looping constructs does Go support?
- What is the difference between
break,continue, andgoto? - How do you use a
switchstatement in Go? - Does Go support
whileordo-whileloops? - How do you iterate over an array, slice, or map in Go?
3. Functions and Methods
- How do you declare and call a function in Go?
- What are multiple return values in Go?
- What are named return values in Go?
- What are variadic functions in Go?
- Can you assign functions to variables in Go?
- How does Go handle function arguments (pass by value or reference)?
- What is a closure in Go?
- What is a higher-order function in Go?
- How do you return an anonymous function in Go?
- Can Go functions have default arguments?
4. Arrays, Slices, and Maps
- What is the difference between arrays and slices in Go?
- How do you declare and initialize slices in Go?
- How do you add elements to a slice?
- What is the capacity of a slice in Go?
- How do you copy a slice?
- What is the difference between
make()andnew()in Go? - How do you declare and iterate over a map in Go?
- What happens if you access a non-existent key in a map?
- How do you delete an element from a map in Go?
- Can a map key be a struct in Go?
5. Structs and Interfaces
- What is a struct in Go?
- How do you create an instance of a struct?
- What is the difference between a struct and a class?
- How do you define methods on a struct?
- How do you implement an interface in Go?
- What is an empty interface (
interface{}) in Go? - What is type assertion in Go?
- What is type switching in Go?
- How does Go handle multiple interfaces?
- Can an interface have fields in Go?
6. Concurrency in Go
- What are goroutines in Go?
- How do you start a goroutine?
- What is the difference between goroutines and threads?
- What are channels in Go?
- What is the difference between buffered and unbuffered channels?
- How do you close a channel in Go?
- What happens when you send data to a closed channel?
- How do you use the
selectstatement with channels? - What is a WaitGroup in Go?
- What is a Mutex in Go, and when would you use it?
7. Error Handling
- How does Go handle errors?
- What is the
errorinterface in Go? - What is
fmt.Errorf()used for? - How do you create custom errors in Go?
- What is the
recover()function in Go? - How do you use
deferin Go? - What is the difference between
panicandrecover? - When should you use
panic()in Go? - How can you propagate an error up the call stack?
- How do you handle errors gracefully in Go?
8. File Handling and I/O
- How do you read and write files in Go?
- What is the difference between
os.Open()andioutil.ReadFile()? - How do you create a new file in Go?
- How do you write data to a file in Go?
- How do you read a file line by line in Go?
- How do you check if a file exists in Go?
- How do you delete a file in Go?
- What is the purpose of
deferwhen handling files? - How do you append to a file instead of overwriting it?
- How do you read a JSON file into a struct?
9. Packages and Modules
- What is a package in Go?
- How do you create a custom package in Go?
- How do you import a package in Go?
- What is the purpose of
init()function in Go? - What is
go modand how does it work? - What is the difference between
go getandgo mod tidy? - How do you manage dependencies in Go?
- What is the GOPATH environment variable?
- What is the difference between
internalandvendordirectories? - How do you make a package private in Go?
10. Web Development with Go
- How do you create a basic HTTP server in Go?
- What is the
net/httppackage used for? - How do you handle GET and POST requests in Go?
- How do you parse query parameters in Go?
- What is the
http.ServeMuxin Go? - How do you create middleware in Go?
- What is
gorilla/mux, and why is it useful? - How do you handle JSON requests and responses in Go?
- How do you use WebSockets in Go?
- How do you secure an HTTP server in Go?
11. Testing and Debugging
- How do you write a unit test in Go?
- What is table-driven testing in Go?
- How do you run tests in Go?
- How do you benchmark code in Go?
- How do you debug a Go program?