Bird
0
0

Why do collections like List<T> generally perform better than arrays when frequently adding or removing elements?

hard🧠 Conceptual Q10 of 15
C Sharp (C#) - Collections
Why do collections like List<T> generally perform better than arrays when frequently adding or removing elements?
ACollections use internal resizing and optimized methods, arrays require manual resizing.
BArrays automatically resize, collections do not.
CCollections store data in a linked list internally, arrays do not.
DArrays have built-in methods for adding/removing elements.
Step-by-Step Solution
Solution:
  1. Step 1: Understand array resizing

    Arrays have fixed size; resizing requires creating a new array and copying elements manually.
  2. Step 2: Understand collection resizing

    Collections like List<T> handle resizing internally and provide optimized methods for adding/removing.
  3. Final Answer:

    Collections use internal resizing and optimized methods, arrays require manual resizing. -> Option A
  4. Quick Check:

    Internal resizing optimization = C [OK]
Quick Trick: Collections handle resizing internally; arrays need manual resizing [OK]
Common Mistakes:
MISTAKES
  • Believing arrays resize automatically
  • Thinking collections use linked lists internally
  • Assuming arrays have add/remove methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes