Interview Q&A

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

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 26–37 of 37

Popular tracks

Junior PDF
What is the time complexity for common operations like Add(), Remove(), and Contains() in SortedSet<T>?

Answer: Due to the underlying balanced tree structure, these operations have O(log n) time complexity. 📘 C# Collection Initializers &amp;amp; LINQ – Interview Questions &amp;amp; Answers What interviewers expect A clear…

Collections Read answer
Junior PDF
What is the purpose of the Peek() method in a Stack<T>?

Peek() returns the top element without removing it. It’s helpful for: Conditional checks Previewing what's next Preventing accidental removal Example: if (stack.Count &gt; 0) { var current = stack.Peek(); } Throws Invali…

Collections Read answer
Junior PDF
What is the difference between TryGetValue() and indexer access in a Dictionary?

Feature TryGetValue() Indexer (dictionary[key]) Safe? Yes – avoids exception No – throws if key doesn't exist Returns Boolean (and output value) Direct value Use case When unsure if key exists When key is guaranteed to e…

Collections Read answer
Junior PDF
What is the difference between Add() and AddRange() in a List<T>?

Answer: Method Purpose dd() Adds one item ddRange () dds multiple items (collection) Example: list.Add(1); // One item list.AddRange(new[] { 2, 3, 4 }); // Multiple What interviewers expect A clear definition tied to Col…

Collections Read answer
Junior PDF
What is the purpose of IReadOnlyCollection<T> and IReadOnlyList<T> interfaces?

These interfaces provide read-only access to collections: IReadOnlyCollection&lt;T&gt; provides Count and enumeration. IReadOnlyList&lt;T&gt; provides index-based access without modification. Example: IReadOnlyList&lt;in…

Collections Read answer
Junior PDF
What is the difference between Add() and Contains() in a HashSet<T>?

Answer: Method Purpose Return Value dd(item) Adds item if not already present true if added, false if duplicate Contains(it em) Checks if item exists in the set true if found, false otherwise What interviewers expect A c…

Collections Read answer
Junior PDF
What is the difference between IEnumerable<T> and ICollection<T> in C#?

Feature IEnumerable &lt;T&gt; ICollection&lt;T&gt; Read-only Yes No Modification Not supported Supports Add, Remove, Clear Count property No Yes (Count) Example: IEnumerable&lt;string&gt; names = new List&lt;string&gt; {…

Collections Read answer
Junior PDF
What is the difference between List<T> and ArrayList in C#?

Feature List&lt;T&gt; ArrayList Generic Yes No Type Safety Compile-time Runtime (casting required) Performanc Better (no boxing) Slower for value types (boxing) Example: List&lt;int&gt; list = new List&lt;int&gt;(); list…

Collections Read answer
Junior PDF
What is the significance of the KeyValuePair<TKey, TValue> structure in Dictionary?

KeyValuePair&lt;TKey, TValue&gt; represents a single item in a dictionary — a key-value pair. Used in: Iteration LINQ queries Return values from dictionary enumerators Example: foreach (KeyValuePair&lt;string, int&gt; en…

Collections Read answer
Junior PDF
What is the difference between Find() and FindAll() in List<T>?

Answer: Method Returns Find() First match FindAll () ll matches in a new list Example: var firstEven = list.Find(x =&amp;gt; x % 2 == 0); var allEvens = list.FindAll(x =&amp;gt; x % 2 == 0); What interviewers expect A cl…

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

Answer: Capacity is the number of elements the list can hold before resizing. It is greater than or equal to Count. Example: list.Capacity = 100; // Optional performance tuning What interviewers expect A clear definition…

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

Answer: Property Meaning Count Number of elements currently in the list Capacit Total allocated slots (memory reserved) Example: Console.WriteLine($"Count: {list.Count}, Capacity: {list.Capacity}"); What interviewers exp…

Collections Read answer

C# Collections C# Programming Tutorial · Collections

Answer: Due to the underlying balanced tree structure, these operations have O(log n) time complexity. 📘 C# Collection Initializers &amp; LINQ – Interview Questions &amp; Answers

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Peek() returns the top element without removing it. It’s helpful for:

  • Conditional checks
  • Previewing what's next
  • Preventing accidental removal

Example:

if (stack.Count > 0)
{
var current = stack.Peek();
}

Throws InvalidOperationException if the stack is empty.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Feature TryGetValue() Indexer (dictionary[key])

Safe? Yes – avoids exception No – throws if key doesn't exist

Returns Boolean (and output

value)

Direct value

Use

case

When unsure if key exists When key is guaranteed to

exist

Example:

if (dictionary.TryGetValue("Bob", out int age)) {

Console.WriteLine(age);

// dictionary["Unknown"]; // throws KeyNotFoundException if missing

Permalink & share

C# Collections C# Programming Tutorial · Collections

Answer: Method Purpose dd() Adds one item ddRange () dds multiple items (collection) Example: list.Add(1); // One item list.AddRange(new[] { 2, 3, 4 }); // Multiple

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# Collections C# Programming Tutorial · Collections

These interfaces provide read-only access to collections:

  • IReadOnlyCollection<T> provides Count and enumeration.
  • IReadOnlyList<T> provides index-based access without modification.

Example:

IReadOnlyList<int> ids = new List<int> { 1, 2, 3 };

Console.WriteLine(ids[0]); // Access element

// ids[0] = 10; // Compile-time error – read-only

Real-world use case:

Useful in APIs where you want to expose collection data but prevent consumers from

modifying it—e.g., returning a list of supported currencies from a service.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Answer: Method Purpose Return Value dd(item) Adds item if not already present true if added, false if duplicate Contains(it em) Checks if item exists in the set true if found, false otherwise

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Feature IEnumerable

<T>

ICollection<T>

Read-only Yes No

Modification Not supported Supports Add, Remove,

Clear

Count property No Yes (Count)

Example:

IEnumerable<string> names = new List<string> { "A", "B" };

// names.Add("C"); // Error

ICollection<string> nameCollection = new List<string> { "A", "B" };

nameCollection.Add("C"); // Allowed

Real-world scenario:

Use IEnumerable<T> for read-only, query-focused tasks like LINQ. Use

ICollection<T> when managing and modifying the collection.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Feature List<T> ArrayList

Generic Yes No

Type Safety Compile-time Runtime (casting required)

Performanc

Better (no boxing) Slower for value types (boxing)

Example:

List<int> list = new List<int>();
list.Add(10); // Type-safe
rrayList arrayList = new ArrayList();

rrayList.Add(10);

int num = (int)arrayList[0]; // Casting required

Best Practice:

lways prefer List<T> in new code. Use ArrayList only when working with legacy

systems.

Permalink & share

C# Collections C# Programming Tutorial · Collections

KeyValuePair<TKey, TValue> represents a single item in a dictionary — a key-value

pair.

Used in:

  • Iteration
  • LINQ queries
  • Return values from dictionary enumerators

Example:

foreach (KeyValuePair<string, int> entry in dictionary)
{

Console.WriteLine($"Key: {entry.Key}, Value: {entry.Value}");

}
Permalink & share

C# Collections C# Programming Tutorial · Collections

Answer: Method Returns Find() First match FindAll () ll matches in a new list Example: var firstEven = list.Find(x =&gt; x % 2 == 0); var allEvens = list.FindAll(x =&gt; x % 2 == 0);

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Answer: Capacity is the number of elements the list can hold before resizing. It is greater than or equal to Count. Example: list.Capacity = 100; // Optional performance tuning

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

C# Collections C# Programming Tutorial · Collections

Answer: Property Meaning Count Number of elements currently in the list Capacit Total allocated slots (memory reserved) Example: Console.WriteLine($"Count: {list.Count}, Capacity: {list.Capacity}");

What interviewers expect

  • A clear definition tied to Collections in C# Collections projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production C# Collections application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in C# Collections architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

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