Recall & Review
beginner
What is a static array?
A static array is a collection of elements with a fixed size that is set when the array is created. Its size cannot be changed later.
Click to reveal answer
beginner
What is a dynamic array?
A dynamic array is a collection of elements that can grow or shrink in size during the program's execution, allowing flexible storage.
Click to reveal answer
intermediate
How does a static array store data compared to a dynamic array?
A static array stores data in a fixed block of memory, while a dynamic array may allocate new memory and copy data when resizing.
Click to reveal answer
beginner
Name one advantage of static arrays.
Static arrays are simple and fast because their size is fixed, so memory is allocated once and access is quick.
Click to reveal answer
beginner
Why might you choose a dynamic array over a static array?
You choose a dynamic array when you need to store a changing number of elements because it can resize automatically.
Click to reveal answer
Which type of array has a fixed size that cannot change after creation?
✗ Incorrect
Static arrays have a fixed size set at creation and cannot be resized.
What happens when a dynamic array runs out of space?
✗ Incorrect
Dynamic arrays allocate more memory and copy elements to allow growth.
Which array type generally uses less memory when the number of elements is known and fixed?
✗ Incorrect
Static arrays allocate exactly the needed memory once, so they use less overhead.
Which array type is better when you need to add or remove elements frequently?
✗ Incorrect
Dynamic arrays can resize, making them better for frequent changes.
What is a common disadvantage of dynamic arrays compared to static arrays?
✗ Incorrect
Dynamic arrays may be slower due to resizing and copying operations.
Explain the main differences between static and dynamic arrays.
Think about size flexibility and memory use.
You got /4 concepts.
Describe a situation where a dynamic array is more useful than a static array.
Consider programs where data size is unknown or changes.
You got /3 concepts.