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 26–50 of 221

Career & HR topics

By tech stack

Mid PDF
Are there any employees in “Legal” department?

Short answer: bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == &quo…

Mid PDF
Convert result to list .Where(e => e.Department == "HR") .ToList();?

Short answer: var hrList = employees This forces query execution (immediate execution). var hrList = employees This forces query execution (immediate execution). Real-world example (ShopNest) ShopNest filters active prod…

Mid PDF
Convert result to list?

Short answer: This forces query execution (immediate execution). 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…

Mid PDF
Use let to simplify nested calculation let tax = e.Salary * 0.1?

Short answer: var taxResult = from e in employees select new { e.Name, Tax = tax }; let stores computed value for reuse. Example code var taxResult = from e in employees select new { e.Name, Tax = tax }; let stores compu…

Mid PDF
Use let to simplify nested calculation?

Short answer: let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed v…

Mid PDF
Why is LINQ deferred?

Short answer: foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time. var query = employees.Where(e => e.Salary > 70000); employees.Add(new…

Mid PDF
Why is LINQ deferred?

Short answer: Why is LINQ deferred? var query = employees.Where(e => e.Salary > 70000); employees.Add(new Employee { Id = 6, Name = "Frank", Department = "IT", Salary = 90000 }); foreach (var em…

Mid PDF
Get top 3 highest-paid employees?

Short answer: Get top 3 highest-paid employees var top3 = employees .OrderByDescending(e => e.Salary) .Take(3); Get top 3 highest-paid employees var top3 = employees .OrderByDescending(e => e.Salary) .Take(3); Get…

Mid PDF
Get bottom 2 lowest-paid employees?

Short answer: Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e => e.Salary) .Take(2); Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e => e.Salary) .Take(2); Get bottom 2 l…

Mid PDF
Get names of employees whose names start with 'A' .Where(e => e.Name.StartsWith("A"))?

Short answer: var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select…

Mid PDF
Get names of employees whose names start with 'A'?

Short answer: Get names of employees whose names start with 'A' var namesStartingA = employees .Where(e => e.Name.StartsWith("A")) .Select(e => e.Name); Follow : Get names of employees whose names start w…

Mid PDF
Get total salary by department?

Short answer: Get total salary by department var totalByDept = employees .GroupBy(e => e.Department) .Select(g => new { Department = g.Key, Total = g.Sum(e => e.Salary) }); Get total salary by department var tot…

Mid PDF
Flatten list of lists using SelectMany List<List<int>> numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } };?

Short answer: var flat = numbers.SelectMany(n =&gt; n); var flat = numbers.SelectMany(n =&gt; n); var flat = numbers.SelectMany(n =&gt; n); var flat = numbers.SelectMany(n =&gt; n); var flat = numbers.SelectMany(n =&gt;…

Mid PDF
Flatten list of lists using SelectMany?

Short answer: Flatten list of lists using SelectMany List&lt;List&lt;int&gt;&gt; numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } var flat = numbers.SelectMany(n =&gt; n); Flatten list of lists using SelectM…

Mid PDF
Use Distinct() on names?

Short answer: Use Distinct() on names var distinctNames = employees .Select(e =&gt; e.Name) .Distinct(); Use Distinct() on names var distinctNames = employees .Select(e =&gt; e.Name) .Distinct(); Use Distinct() on names…

Mid PDF
Convert list of salaries to array .Select(e => e.Salary) .ToArray();?

Short answer: double[] salaryArray = employees Real-world example (ShopNest) ShopNest maps entities to DTOs with .Select(o =&gt; new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal field…

Mid PDF
Convert list of salaries to array?

Short answer: Convert list of salaries to array double[] salaryArray = employees .Select(e =&gt; e.Salary) .ToArray(); Convert list of salaries to array double[] salaryArray = employees .Select(e =&gt; e.Salary) .ToArray…

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

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

Mid PDF
Find duplicate departments?

Short answer: Find duplicate departments var duplicateDepts = employees Follow : .GroupBy(e =&gt; e.Department) .Where(g =&gt; g.Count() &gt; 1) .Select(g =&gt; g.Key); Find duplicate departments var duplicateDepts = emp…

Mid PDF
Compare LINQ to SQL vs LINQ to Objects?

Short answer: Compare LINQ to SQL vs LINQ to Objects? Answer: LINQ to Objects runs in memory on collections (List&lt;T&gt;, arrays). LINQ to SQL/EF builds expression trees and translates to SQL queries. Real-world exampl…

Mid PDF
Show all departments even if no employees (outer join) join e in employees on d.Name equals e.Department from eg in empGroup.DefaultIfEmpty() select new { Dept = d.Name, EmpName = eg?.Name?? "No Employee" };

Short answer: var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup va…

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[] { &quot;A&quot;, &quot;B&quot;, &quot;C&quot; }; var scores = new[] { 10, 20, 30 }; var zipped = names.Zip(scores, (n, s) =&gt; $&quot;{n} scored {s}&quot;); 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…

LINQ LINQ Tutorial · LINQ

Short answer: bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department ==…

Explain a bit more

"Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal");

Example code

bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal"); bool anyLegal = employees.Any(e => e.Department == "Legal");

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 hrList = employees This forces query execution (immediate execution). var hrList = employees This forces query execution (immediate execution).

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: This forces query execution (immediate execution).

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 taxResult = from e in employees select new { e.Name, Tax = tax }; let stores computed value for reuse.

Example code

var taxResult = from e in employees
select new { e.Name, Tax = tax }; let stores computed value for reuse.

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: let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse.

Example code

let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse. let stores computed value for reuse.

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: foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time. var query = employees.Where(e => e.Salary > 70000); employees.Add(new Employee { Id = 6, Name = "Frank", Department =

Example code

"IT", Salary = 90000 });

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: Why is LINQ deferred? var query = employees.Where(e => e.Salary > 70000); employees.Add(new Employee { Id = 6, Name = "Frank", Department = "IT", Salary = 90000 }); foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time. Why is LINQ deferred? var query =… employees.Where(e =>…… e.Salary > 70000); employees.Add(new Employee { Id = 6, Name =…

Explain a bit more

"Frank", Department = "IT", Salary = 90000 }); foreach (var emp in query) Console.WriteLine(emp.Name); ✅ Output includes “Frank” — because query is executed at enumeration time.

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: Get top 3 highest-paid employees var top3 = employees .OrderByDescending(e => e.Salary) .Take(3); Get top 3 highest-paid employees var top3 = employees .OrderByDescending(e => e.Salary) .Take(3); Get top 3 highest-paid employees var top3 = employees .OrderByDescending(e => e.Salary) .Take(3); Get top 3 highest-paid employees var top3 = employees… OrderByDescending(e => e.Salary) .Take(3);

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: Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e => e.Salary) .Take(2); Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e => e.Salary) .Take(2); Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e => e.Salary) .Take(2); Get bottom 2 lowest-paid employees var bottom2 = employees .OrderBy(e =>…

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 namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e =>…

Example code

var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name); var namesStartingA = employees .Select(e => e.Name);

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: Get names of employees whose names start with 'A' var namesStartingA = employees .Where(e => e.Name.StartsWith("A")) .Select(e => e.Name); Follow : Get names of employees whose names start with 'A' var namesStartingA = employees .Where(e => e.Name.StartsWith("A")) .Select(e => e.Name); Follow : Get names of employees whose names start with 'A' var… namesStartingA = employees .Where(e => e.Name.StartsWith("A"))…

Explain a bit more

Select(e => e.Name); Follow : Get names of employees whose names start with 'A' var namesStartingA = employees .Where(e => e.Name.StartsWith("A")) .Select(e => e.Name); Follow :

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: Get total salary by department var totalByDept = employees .GroupBy(e => e.Department) .Select(g => new { Department = g.Key, Total = g.Sum(e => e.Salary) }); Get total salary by department var totalByDept = employees .GroupBy(e => e.Department) .Select(g => new { Department = g.Key, Total = g.Sum(e => e.Salary) }); Real-world… example (ShopNest) ShopNest…… uses LINQ to query orders: filter by date, project to a…

Explain a bit more

summary DTO, and order by total—readable C# that becomes SQL under EF Core. Get total salary by department var totalByDept = employees .GroupBy(e => e.Department) .Select(g => new { Department = g.Key, Total = g.Sum(e => e.Salary) }); Get total salary by department var totalByDept = employees .GroupBy(e => e.Department) .Select(g => new { Department = g.Key, Total = 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 flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n);

Example code

var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n); var flat = numbers.SelectMany(n => n);

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: Flatten list of lists using SelectMany List<List<int>> numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } var flat = numbers.SelectMany(n => n); Flatten list of lists using SelectMany List<List<int>> numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } var flat = numbers.SelectMany(n => n); Real-world example… (ShopNest) ShopNest maps…… entities to DTOs with .Select(o => new OrderSummaryDto { Id…

Explain a bit more

= o.Id, Total = o.Total }) so the API does not leak internal fields. Flatten list of lists using SelectMany List<List<int>> numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } var flat = numbers.SelectMany(n => n); Flatten list of lists using SelectMany List<List<int>> numbers = new() { new() { 1, 2 }, new() { 3, 4 }, new() { 5 } var flat = numbers.SelectMany(n => n); 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: Use Distinct() on names var distinctNames = employees .Select(e => e.Name) .Distinct(); Use Distinct() on names var distinctNames = employees .Select(e => e.Name) .Distinct(); Use Distinct() on names var distinctNames = employees .Select(e => e.Name) .Distinct(); Use Distinct() on names var distinctNames = employees .Select(e => e.Name) .Distinct();

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: double[] salaryArray = employees

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: Convert list of salaries to array double[] salaryArray = employees .Select(e => e.Salary) .ToArray(); Convert list of salaries to array double[] salaryArray = employees .Select(e => e.Salary) .ToArray(); Convert list of salaries to array double[] salaryArray = employees .Select(e => e.Salary) .ToArray(); Convert list of salaries to array double[]… salaryArray = employees .Select(e => e.Salary) .ToArray();

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 duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key);

Example code

var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = employees .Select(g => g.Key); var duplicateDepts = 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 departments var duplicateDepts = employees Follow : .GroupBy(e => e.Department) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate departments var duplicateDepts = employees Follow : .GroupBy(e => e.Department) .Where(g => g.Count() > 1) .Select(g => g.Key); Find duplicate departments var duplicateDepts = employees Follow :… GroupBy(e => e.Department) .Where(g => g.Count() > 1) .Select(g…

Explain a bit more

=> g.Key); Find duplicate departments var duplicateDepts = employees Follow : .GroupBy(e => e.Department) .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: Compare LINQ to SQL vs LINQ to Objects? Answer: LINQ to Objects runs in memory on collections (List<T>, arrays). LINQ to SQL/EF builds expression trees and translates to SQL queries.

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 allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup

Example code

var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup var allDepts = from d in departments into empGroup

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: 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
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