Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 101–108 of 108

Popular tracks

Mid PDF
How can you remove all items from a Dictionary? Follow:

Short answer: Use the Clear() method to remove all key-value pairs. Explain a bit more dictionary.Clear(); This resets the dictionary to an empty state. 📘 C# Queue<T> – Interview Questions & Use the Clear(…

Collections Read answer
Mid PDF
How does the Contains() method work in a List<T>?

Short answer: Contains(item) checks whether the item exists in the list. It uses Equals() internally. Example code bool exists = list.Contains(10); Note: For custom objects, override Equals() and GetHashCode(). Real-worl…

Collections Read answer
Junior PDF
What is the Capacity property in a List<T>?

Short answer: Capacity is the number of elements the list can hold before resizing. It is greater than or equal to Count. Example code list.Capacity = 100; // Optional performance tuning Real-world example (ShopNest) In…

Collections Read answer
Junior PDF
What is the difference between Count and Capacity in List<T>?

Short answer: Property Meaning Count Number of elements currently in the list Capacit Total allocated slots (memory reserved) Example code Console.WriteLine($&quot;Count: {list.Count}, Capacity: {list.Capacity}&quot;); R…

Collections Read answer
Mid PDF
How do you check if a List<T> contains a duplicate element?

Short answer: Use GroupBy, Distinct, or nested loops. Example: bool hasDuplicates = list.Count != list.Distinct().Count(); Example code Use GroupBy, Distinct, or nested loops. Example: bool hasDuplicates = list.Count !=…

Collections Read answer
Mid PDF
How would you convert a List<T> into an array in C#?

Short answer: Use ToArray() method. Example: int[] array = list.ToArray(); Useful when interfacing with APIs that require arrays. Example code Use ToArray() method. Example: int[] array = list.ToArray(); Useful when inte…

Collections Read answer
Mid PDF
How do you remove duplicates from a List<T>?

Short answer: list = list.Distinct().ToList(); For custom objects, override Equals() and GetHashCode(). Example code list = list.Distinct().ToList(); For custom objects, override Equals() and GetHashCode(). Real-world ex…

Collections Read answer
Mid PDF
How do you get the index of an element in a List<T>?

Short answer: Use IndexOf(item) or FindIndex(predicate). Example: int index = list.IndexOf(10); int indexByCondition = list.FindIndex(x =&gt; x &gt; 100); 📘 C# Dictionary&lt;TKey, TValue&gt; – Interview Questions &amp;…

Collections Read answer

C# Collections C# Programming Tutorial · Collections

Short answer: Use the Clear() method to remove all key-value pairs.

Explain a bit more

dictionary.Clear(); This resets the dictionary to an empty state. 📘 C# Queue<T> – Interview Questions &amp; Use the Clear() method to remove all key-value pairs. dictionary.Clear(); This resets the dictionary to an empty state. 📘 C# Queue<T> – Interview Questions &amp; Use the Clear() method to remove all key-value pairs. dictionary.Clear(); This resets the dictionary to an empty state. 📘 C# Queue<T> – Interview Questions &amp; Use the Clear() method to remove all key-value pairs. dictionary.Clear(); This resets the dictionary to an empty state. 📘 C# Queue<T> – Interview Questions &amp;

Real-world example (ShopNest)

ShopNest caches product prices in a Dictionary<string, decimal> keyed by SKU so checkout can look up a price in O(1) instead of scanning a list.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Contains(item) checks whether the item exists in the list. It uses Equals() internally.

Example code

bool exists = list.Contains(10); Note: For custom objects, override Equals() and GetHashCode().

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Capacity is the number of elements the list can hold before resizing. It is greater than or equal to Count.

Example code

list.Capacity = 100; // Optional performance tuning

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Property Meaning Count Number of elements currently in the list Capacit Total allocated slots (memory reserved)

Example code

Console.WriteLine($"Count: {list.Count}, Capacity: {list.Capacity}");

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Use GroupBy, Distinct, or nested loops. Example: bool hasDuplicates = list.Count != list.Distinct().Count();

Example code

Use GroupBy, Distinct, or nested loops. Example: bool hasDuplicates = list.Count != list.Distinct().Count();

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Use ToArray() method. Example: int[] array = list.ToArray(); Useful when interfacing with APIs that require arrays.

Example code

Use ToArray() method. Example: int[] array = list.ToArray(); Useful when interfacing with APIs that require arrays.

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: list = list.Distinct().ToList(); For custom objects, override Equals() and GetHashCode().

Example code

list = list.Distinct().ToList();
For custom objects, override Equals() and GetHashCode().

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# Collections C# Programming Tutorial · Collections

Short answer: Use IndexOf(item) or FindIndex(predicate). Example: int index = list.IndexOf(10); int indexByCondition = list.FindIndex(x => x > 100); 📘 C# Dictionary<TKey, TValue> – Interview Questions & Answers

Example code

Use IndexOf(item) or FindIndex(predicate). Example: int index = list.IndexOf(10);
int indexByCondition = list.FindIndex(x => x > 100); 📘 C# Dictionary<TKey, TValue> – Interview Questions & Answers

Real-world example (ShopNest)

In ShopNest, an order page loads products with List<Product> so you can Add items to the cart and access them by index. Use IEnumerable<T> when you only need to loop (for example, printing invoice lines).

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details