Recall & Review
beginner
What is a key limitation of arrays compared to collections in C#?
Arrays have a fixed size, meaning once created, their length cannot change. Collections can grow or shrink dynamically.
Click to reveal answer
beginner
How do collections improve code flexibility over arrays?
Collections provide methods to add, remove, and search items easily, making code more adaptable to changing data.
Click to reveal answer
beginner
Name a common collection type in C# that is preferred over arrays for dynamic data.
List<T> is a common collection that allows dynamic resizing and easy manipulation of elements.
Click to reveal answer
intermediate
Why might you choose an array over a collection in C#?
Arrays can be more efficient in memory and performance when the size is fixed and known in advance.
Click to reveal answer
intermediate
Explain how collections support better code readability compared to arrays.
Collections have built-in methods with clear names like Add, Remove, and Contains, making code easier to understand than manual array management.
Click to reveal answer
Which of the following is true about arrays in C#?
✗ Incorrect
Arrays have a fixed size once created and do not provide methods like Add or Remove.
What is a main advantage of using List<T> over arrays?
✗ Incorrect
List can grow or shrink dynamically and provides methods like Add, Remove, and Contains.
When might arrays be preferred over collections?
✗ Incorrect
Arrays can be more efficient when the size is fixed and known, improving performance.
Which collection method is NOT available in arrays?
✗ Incorrect
Arrays do not have an Add method; their size is fixed.
Why do collections improve code readability?
✗ Incorrect
Collections provide methods like Add, Remove, and Contains, making code easier to read and maintain.
Explain why collections are often preferred over arrays in C# programming.
Think about how easy it is to change the number of items.
You got /4 concepts.
Describe a scenario where using an array might be better than a collection.
Consider when data size does not change.
You got /3 concepts.