1. Home
  2. Docs
  3. Interview Technical Quest...
  4. C# Technical Interview Qu...
  5. Section 4: Collections & Generics (46–60)

Section 4: Collections & Generics (46–60)

46. What are collections in C#?
Groups of objects. Examples: Array, List, Dictionary, HashSet.

47. Difference between Array and List?

  • Array: fixed size
  • List: dynamic, part of System.Collections.Generic

48. Difference between List and LinkedList?

  • List: array-based, fast indexing
  • LinkedList: node-based, fast insertion/deletion

49. Difference between Dictionary and Hashtable?

  • Dictionary<K,V>: Generic, type-safe
  • Hashtable: Non-generic, stores objects

50. Difference between Stack and Queue?

  • Stack: LIFO
  • Queue: FIFO

51. What is ConcurrentDictionary?
Thread-safe dictionary for multi-threaded environments.

52. What is IEnumerable vs ICollection?

  • IEnumerable: read-only, allows iteration
  • ICollection: adds Count, Add, Remove methods

53. What is IList?
Provides index-based access to a collection.

54. What is ObservableCollection?
Collection that raises events when items are added/removed, useful for data binding.

55. What is a generic type?
Type parameterized classes/methods for type safety.

56. Example of a generic method:

public T Max<T>(T a, T b) where T : IComparable<T> => a.CompareTo(b) > 0 ? a : b;

57. Difference between List<T> and IEnumerable<T>?
List<T> is a concrete collection; IEnumerable<T> is an interface for iteration.

58. What is ReadOnlyCollection?
Wraps a collection to prevent modification.

59. What is SortedList vs SortedDictionary?

  • SortedList: array-based, slower insertion, fast access
  • SortedDictionary: tree-based, faster insertion

60. Difference between HashSet and List?
HashSet prevents duplicates, optimized for lookups.

How can we help?