📘 Week 4 – Crucial Questions
(Collections, Pointers & Memory Basics)
🔹 Slices & Maps
- What is the difference between an array and a slice?
- Why are slices more common than arrays in Go?
- What happens when you append to a slice?
- What is the zero value of a slice?
- What happens when you access a key that doesn’t exist in a map?
🔹 Pointers & Memory
- Why does Go have pointers but not pointer arithmetic?
- What happens when you pass a struct by value?
- When should you use a pointer receiver?
- What is the zero value of a pointer?
- What happens if you dereference a nil pointer?
🔹 Design & Performance Thinking
- Why might copying large structs be inefficient?
- What are the risks of overusing pointers?
- When is it better to return a value instead of a pointer?
- What is escape analysis?
- Why is understanding memory important even in a garbage-collected language?