0
0
Goprogramming~5 mins

Array limitations in Go - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a fixed size array in Go?
An array in Go has a fixed size defined at the time of declaration. This size cannot be changed later.
Click to reveal answer
beginner
Can you resize an array in Go after it is created?
No, arrays in Go cannot be resized after creation. You must create a new array if you need a different size.
Click to reveal answer
intermediate
What happens if you try to access an index outside the array bounds in Go?
Accessing an index outside the array bounds causes a runtime panic error, stopping the program.
Click to reveal answer
intermediate
Why might arrays be less flexible than slices in Go?
Arrays have fixed size and cannot grow or shrink, while slices are dynamic and can change size.
Click to reveal answer
intermediate
How does Go treat arrays when passed to functions?
Arrays are passed by value, meaning a copy is made. Changes inside the function do not affect the original array.
Click to reveal answer
What is the size of an array in Go after it is declared?
AFixed and cannot be changed
BCan be increased dynamically
CCan be decreased dynamically
DDepends on the number of elements added
What happens if you access an array index that is out of range in Go?
AReturns zero value silently
BCompiles with a warning
CCauses a runtime panic error
DAutomatically resizes the array
How are arrays passed to functions in Go?
ABy value (copy)
BBy pointer automatically
CBy reference
DThey cannot be passed
Which Go type is more flexible than arrays for changing size?
AMap
BSlice
CStruct
DChannel
Can you change the length of an array after it is created in Go?
AYes, using built-in functions
BOnly if the array is a pointer
CYes, by appending elements
DNo, arrays have fixed length
Explain the main limitations of arrays in Go and how they affect programming.
Think about size, passing behavior, and error handling.
You got /4 concepts.
    Compare arrays and slices in Go focusing on their limitations and flexibility.
    Consider size and how they behave when passed around.
    You got /4 concepts.