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 1876–1900 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Show all departments even if no employees (outer join)?

Short answer: Show all departments even if no employees (outer join) var allDepts = from d in departments join e in employees on d.Name equals e.Department into empGroup from eg in empGroup.DefaultIfEmpty() select new {…

Mid PDF
Use Zip() to combine two lists?

Short answer: var names = new[] { "A", "B", "C" }; var scores = new[] { 10, 20, 30 }; var zipped = names.Zip(scores, (n, s) => $"{n} scored {s}"); Example code var names = new[]…

Mid PDF
Filter only numeric strings using OfType<T>()?

Short answer: object[] mixed = { &quot;One&quot;, 2, &quot;Three&quot;, 4 }; var numbers = mixed.OfType&lt;int&gt;(); Example code object[] mixed = { &quot;One&quot;, 2, &quot;Three&quot;, 4 }; var numbers = mixed.OfType…

Mid PDF
Group by multiple fields (composite key)?

Short answer: var grouped = employees .GroupBy(e =&gt; new { e.Department, e.Salary }); var grouped = employees .GroupBy(e =&gt; new { e.Department, e.Salary }); var grouped = employees .GroupBy(e =&gt; new { e.Departmen…

Mid PDF
Paginate: Get page 2, size 3 .Skip((pageIndex - 1) * pageSize) .Take(pageSize);?

Short answer: int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex…

Mid PDF
Paginate: Get page 2, size 3?

Short answer: Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; var page = employees .Skip((pageIndex - 1) * pageSize) .Take(pageSize); Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; va…

Mid PDF
Why use AsEnumerable()?

Short answer: var query = dbContext.Employees .Where(e =&gt; CustomFunction(e.Name)); var query = dbContext.Employees .Where(e =&gt; CustomFunction(e.Name)); var query = dbContext.Employees .Where(e =&gt; CustomFunction(…

Mid PDF
Why use AsEnumerable()?

Short answer: Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e =&gt; CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable(…

Mid PDF
Detect and avoid N+1 query in EF?

Short answer: Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o =&gt; o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load relate…

Mid PDF
How to force immediate execution?

Short answer: How to force immediate execution? Use .ToList(), .ToArray(), .Count(), .First() etc. Follow : Real-world example (ShopNest) ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in…

Mid PDF
Can we use LINQ on JSON?

Short answer: Can we use LINQ on JSON? ✅ Yes — using System.Text.Json or Newtonsoft.Json, then LINQ on parsed objects. Real-world example (ShopNest) ShopNest uses LINQ to query orders: filter by date, project to a summar…

Mid PDF
How to create a dummy sequence of numbers from 1 to 10?

Short answer: var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers…

Mid PDF
Repeat a value 5 times?

Short answer: var fives = Enumerable.Repeat(&quot;Hi&quot;, 5); var fives = Enumerable.Repeat(&quot;Hi&quot;, 5); var fives = Enumerable.Repeat(&quot;Hi&quot;, 5); var fives = Enumerable.Repeat(&quot;Hi&quot;, 5); var fi…

Mid PDF
What does DefaultIfEmpty() do?

Short answer: What does DefaultIfEmpty() do? Returns a default value if the sequence is empty (e.g. in left join). Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a…

Mid PDF
How to write a subquery?

Short answer: var topEarners = employees .Where(e =&gt; e.Salary &gt; employees.Average(x =&gt; x.Salary)); Example code var topEarners = employees .Where(e =&gt; e.Salary &gt; employees.Average(x =&gt; x.Salary)); Real-…

Mid PDF
Check if a department has more than 2 employees?

Short answer: .Count(e =&gt; e.Department == &quot;IT&quot;) &gt; 2; .Count(e =&gt; e.Department == &quot;IT&quot;) &gt; 2; .Count(e =&gt; e.Department == &quot;IT&quot;) &gt; 2; .Count(e =&gt; e.Department == &quot;IT&q…

Mid PDF
Check if a department has more than 2 employees?

Short answer: Check if a department has more than 2 employees? Explain a bit more bool deptCheck = employees .Count(e =&gt; e.Department == &quot;IT&quot;) &gt; 2; Check if a department has more than 2 employees? bool de…

Mid PDF
Create dictionary from list?

Short answer: var empDict = employees.ToDictionary(e =&gt; e.Id); var empDict = employees.ToDictionary(e =&gt; e.Id); var empDict = employees.ToDictionary(e =&gt; e.Id); var empDict = employees.ToDictionary(e =&gt; e.Id)…

Mid PDF
Sum salary by department, only if salary > 70k .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)?

Short answer: var sum = employees .Select(g =&gt; new { g.Key, Sum = g.Sum(e =&gt; e.Salary) }); Example code var sum = employees .Select(g =&gt; new { g.Key, Sum = g.Sum(e =&gt; e.Salary) }); Real-world example (ShopNes…

Mid PDF
Sum salary by department, only if salary > 70k?

Short answer: Sum salary by department, only if salary &gt; 70k Follow : var sum = employees .Where(e =&gt; e.Salary &gt; 70000) .GroupBy(e =&gt; e.Department) .Select(g =&gt; new { g.Key, Sum = g.Sum(e =&gt; e.Salary) }…

Mid PDF
Find duplicate names .GroupBy(e => e.Name) .Where(g => g.Count() > 1)?

Short answer: var dupNames = employees .Select(g =&gt; g.Key); var dupNames = employees .Select(g =&gt; g.Key); var dupNames = employees .Select(g =&gt; g.Key); var dupNames = employees .Select(g =&gt; g.Key); var dupNam…

Mid PDF
Find duplicate names?

Short answer: Find duplicate names var dupNames = employees .GroupBy(e =&gt; e.Name) .Where(g =&gt; g.Count() &gt; 1) .Select(g =&gt; g.Key); Find duplicate names var dupNames = employees .GroupBy(e =&gt; e.Name) .Where(…

Mid PDF
Merge two employee lists?

Short answer: var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merg…

Mid PDF
Select only employees with even ID?

Short answer: var evens = employees.Where(e =&gt; e.Id % 2 == 0); var evens = employees.Where(e =&gt; e.Id % 2 == 0); var evens = employees.Where(e =&gt; e.Id % 2 == 0); var evens = employees.Where(e =&gt; e.Id % 2 == 0)…

Mid PDF
Group employees by first letter of name?

Short answer: var alphaGroup = employees .GroupBy(e =&gt; e.Name[0]); var alphaGroup = employees .GroupBy(e =&gt; e.Name[0]); var alphaGroup = employees .GroupBy(e =&gt; e.Name[0]); var alphaGroup = employees .GroupBy(e…

LINQ LINQ Tutorial · LINQ

Short answer: Show all departments even if no employees (outer join) var allDepts = from d in departments join e in employees on d.Name equals e.Department into empGroup from eg in empGroup.DefaultIfEmpty() select new { Dept = d.Name, EmpName = eg?.Name ?? "No Employee"

Real-world example (ShopNest)

A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.

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

LINQ LINQ Tutorial · LINQ

Short answer: var names = new[] { "A", "B", "C" }; var scores = new[] { 10, 20, 30 }; var zipped = names.Zip(scores, (n, s) => $"{n} scored {s}");

Example code

var names = new[] { "A", "B", "C" };
var scores = new[] { 10, 20, 30 };
var zipped = names.Zip(scores, (n, s) => $"{n} scored {s}");

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: object[] mixed = { "One", 2, "Three", 4 }; var numbers = mixed.OfType<int>();

Example code

object[] mixed = { "One", 2, "Three", 4 };
var numbers = mixed.OfType<int>();

Real-world example (ShopNest)

ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.

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

LINQ LINQ Tutorial · LINQ

Short answer: var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department,…

Explain a bit more

e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary });

Example code

var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary }); var grouped = employees .GroupBy(e => new { e.Department, e.Salary });

Real-world example (ShopNest)

A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.

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

LINQ LINQ Tutorial · LINQ

Short answer: int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize…

Explain a bit more

= 3; int pageIndex = 2; var page = employees

Example code

int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees int pageSize = 3; int pageIndex = 2; var page = employees

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; var page = employees .Skip((pageIndex - 1) * pageSize) .Take(pageSize); Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; var page = employees .Skip((pageIndex - 1) * pageSize) .Take(pageSize); Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; var page =… employees .Skip((pageIndex - 1) * pageSize) .Take(pageSize);…

Explain a bit more

Paginate: Get page 2, size 3 int pageSize = 3; int pageIndex = 2; var page = employees .Skip((pageIndex - 1) * pageSize) .Take(pageSize);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name)); var query = dbContext.Employees .Where(e => CustomFunction(e.Name));

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your… logic can't be translated… to… Why use AsEnumerable()? var query = dbContext.Employees…

Explain a bit more

AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your logic can't be translated to SQL. Why use AsEnumerable()? var query = dbContext.Employees .AsEnumerable() // switch to in-memory .Where(e => CustomFunction(e.Name)); ✅ Use when your… logic can't be translated to SQL.

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var… orders = dbContext.Orders .Include(o => o.Customer)…

Explain a bit more

ToList(); Detect and avoid N+1 query in EF? Use Include() to load related entities: var orders = dbContext.Orders .Include(o => o.Customer) .ToList();

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: How to force immediate execution? Use .ToList(), .ToArray(), .Count(), .First() etc. Follow :

Real-world example (ShopNest)

ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in the repository—so the SQL runs one time, not inside a loop.

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

LINQ LINQ Tutorial · LINQ

Short answer: Can we use LINQ on JSON? ✅ Yes — using System.Text.Json or Newtonsoft.Json, then LINQ on parsed objects.

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10);

Example code

var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10); var numbers = Enumerable.Range(1, 10);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5);

Example code

var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5); var fives = Enumerable.Repeat("Hi", 5);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: What does DefaultIfEmpty() do? Returns a default value if the sequence is empty (e.g. in left join).

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

LINQ LINQ Tutorial · LINQ

Short answer: var topEarners = employees .Where(e => e.Salary > employees.Average(x => x.Salary));

Example code

var topEarners = employees
.Where(e => e.Salary > employees.Average(x => x.Salary));

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2; .Count(e => e.Department == "IT") > 2;

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: Check if a department has more than 2 employees?

Explain a bit more

bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2; Check if a department has more than 2 employees? bool deptCheck = employees .Count(e => e.Department == "IT") > 2;

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id);

Example code

var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id); var empDict = employees.ToDictionary(e => e.Id);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var sum = employees .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

Example code

var sum = employees
.Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

Real-world example (ShopNest)

ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.

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

LINQ LINQ Tutorial · LINQ

Short answer: Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department) .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)… Select(g => new { g.Key, Sum =…… Sum salary by department, only if salary > 70k Follow : var…

Explain a bit more

sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department) .Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) }); Sum salary by department, only if salary > 70k Follow : var sum = employees .Where(e => e.Salary > 70000) .GroupBy(e => e.Department)… Select(g => new { g.Key, Sum = g.Sum(e => e.Salary) });

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key);

Example code

var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key); var dupNames = employees .Select(g => g.Key);

Real-world example (ShopNest)

ShopNest filters active products with products.Where(p => p.IsActive && p.Stock > 0) before showing the catalog.

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

LINQ LINQ Tutorial · LINQ

Short answer: Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate names var dupNames = employees .GroupBy(e => e.Name) .Where(g => g.Count() > 1) .Select(g => g.Key); Find… duplicate names var dupNames = employees .GroupBy(e => e.Name)…

Explain a bit more

Where(g => g.Count() > 1) .Select(g => g.Key);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2);

Example code

var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2); var merged = list1.Union(list2);

Real-world example (ShopNest)

ShopNest uses LINQ to query orders: filter by date, project to a summary DTO, and order by total—readable C# that becomes SQL under EF Core.

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

LINQ LINQ Tutorial · LINQ

Short answer: var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0); var evens = employees.Where(e => e.Id % 2 == 0);

Real-world example (ShopNest)

ShopNest maps entities to DTOs with .Select(o => new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields.

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

LINQ LINQ Tutorial · LINQ

Short answer: var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e =>…

Example code

var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]); var alphaGroup = employees .GroupBy(e => e.Name[0]);

Real-world example (ShopNest)

A sales report joins orders and customers, then GroupBy(c => c.City) to show revenue per city.

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