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 2551–2575 of 4608

Career & HR topics

By tech stack

Popular tracks

Junior PDF
What is the average salary in IT?

Short answer: double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Avera…

Junior PDF
What is the average salary in IT?

Short answer: What is the average salary in IT? double avgSalary = employees .Where(e => e.Department == "IT") .Average(e => e.Salary); What is the average salary in IT? double avgSalary = employees .Wher…

Mid PDF
Find the highest salary in the company?

Short answer: double max = employees.Max(e => e.Salary); double max = employees.Max(e => e.Salary); double max = employees.Max(e => e.Salary); double max = employees.Max(e => e.Salary); Real-world example (Sh…

Mid PDF
Group employees by department 📝 To print the groups: foreach (var group in grouped) { Console.WriteLine($"Department: {group.Key}"); foreach (var emp in group) Console.WriteLine($" - {emp.Name}"); }

Short answer: var grouped = employees .GroupBy(e => e.Department); Each group is an IGrouping<string, Employee> Example code var grouped = employees .GroupBy(e => e.Department); Each group is an IGrouping<…

Mid PDF
Group employees by department?

Short answer: Each group is an IGrouping<string, 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 D…

Mid PDF
For each department, show average salary?

Short answer: For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department,…

Mid PDF
Inner Join: Get employee names with their department location join d in departments on e.Department equals d.Name select new { e.Name, Department = e.Department, d.Location };

Short answer: var joined = from e in employees join matches based on keys. Explain a bit more var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var…

Mid PDF
Inner Join: Get employee names with their department location?

Short answer: join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join match…

Mid PDF
Left Outer Join: Include employees even if department not found join d in departments on e.Department equals d.Name from d in deptGroup.DefaultIfEmpty() select new { e.Name, Department = e.Department, Location = d?

Short answer: .Location?? "Not Found" }; var leftJoin = from e in employees into deptGroup Uses DefaultIfEmpty() to simulate outer join. Example code .Location?? "Not Found" }; var leftJoin = from e i…

Mid PDF
Left Outer Join: Include employees even if department not found?

Short answer: Uses DefaultIfEmpty() to simulate outer join. 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 Define…

Mid PDF
Get first employee with salary > 80000?

Short answer: var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 8000…

Mid PDF
Use Single vs First — what's the difference?

Short answer: >1 ✅ Tip: Use Single when you're sure there will be exactly one result. var onlyHR = employees.SingleOrDefault(e => e.Id == 1); // throws if var firstHR = employees.FirstOrDefault(e => e.Id == 1);…

Mid PDF
Use Single vs First — what's the difference?

Short answer: Use Single vs First — what's the difference? var onlyHR = employees.SingleOrDefault(e => e.Id == 1); // throws if var firstHR = employees.FirstOrDefault(e => e.Id == 1); // safe ✅ Tip: Use Single when…

Mid PDF
Find employees in both List A and List B?

Short answer: var listA = employees.Take(3); var listB = employees.Skip(2); var common = listA.Select(e => e.Id) .Intersect(listB.Select(e => e.Id)); Example code var listA = employees.Take(3); var listB = employee…

Mid PDF
Get employees in List A but not in List B?

Short answer: var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(l…

Mid PDF
Skip top 2 highest salaries and take next 2?

Short answer: Skip top 2 highest salaries and take next 2 var result = employees .OrderByDescending(e => e.Salary) .Skip(2) .Take(2); Skip top 2 highest salaries and take next 2 var result = employees .OrderByDescendi…

Mid PDF
Are all employees earning more than 50k?

Short answer: bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(…

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…

LINQ LINQ Tutorial · LINQ

Short answer: double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Average(e => e.Salary); double avgSalary = employees .Average(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: What is the average salary in IT? double avgSalary = employees .Where(e => e.Department == "IT") .Average(e => e.Salary); What is the average salary in IT? double avgSalary = employees .Where(e => e.Department == "IT") .Average(e => e.Salary); What is the average salary in IT? double avgSalary = employees .Where(e => e.Department == "IT") .Average(e =>… e.Salary); What is the average salary in IT? double avgSalary =…

Explain a bit more

employees .Where(e => e.Department == "IT") .Average(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: double max = employees.Max(e => e.Salary); double max = employees.Max(e => e.Salary); double max = employees.Max(e => e.Salary); double max = employees.Max(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 grouped = employees .GroupBy(e => e.Department); Each group is an IGrouping<string, Employee>

Example code

var grouped = employees
.GroupBy(e => e.Department); Each group is an IGrouping<string, 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: Each group is an IGrouping<string, 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: For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For… each department, show average salary var avgByDept =…

Explain a bit more

employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees…

Example code

For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For… each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary = g.Average(e => e.Salary) }); For each department, show average salary var avgByDept = employees .GroupBy(e => e.Department) .Select(g => new Department = g.Key, AverageSalary =… g.Average(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 joined = from e in employees join matches based on keys.

Explain a bit more

var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys.

Example code

var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys. var joined = from e in employees join matches based on keys.

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: join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys.

Example code

join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys. join matches based on keys.

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: .Location?? "Not Found" }; var leftJoin = from e in employees into deptGroup Uses DefaultIfEmpty() to simulate outer join.

Example code

.Location?? "Not Found" }; var leftJoin = from e in employees
into deptGroup Uses DefaultIfEmpty() to simulate outer join.

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: Uses DefaultIfEmpty() to simulate outer join.

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 highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid =…

Explain a bit more

employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000);

Example code

var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000); var highPaid = employees.FirstOrDefault(e => e.Salary > 80000);

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: >1 ✅ Tip: Use Single when you're sure there will be exactly one result. var onlyHR = employees.SingleOrDefault(e => e.Id == 1); // throws if var firstHR = employees.FirstOrDefault(e => e.Id == 1); // safe

Example code

>1 ✅ Tip: Use Single when you're sure there will be exactly one result. var onlyHR = employees.SingleOrDefault(e => e.Id == 1); // throws if
var firstHR = employees.FirstOrDefault(e => e.Id == 1); // safe

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: Use Single vs First — what's the difference? var onlyHR = employees.SingleOrDefault(e => e.Id == 1); // throws if var firstHR = employees.FirstOrDefault(e => e.Id == 1); // safe ✅ Tip: Use Single when you're sure there will be exactly one result.

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 listA = employees.Take(3); var listB = employees.Skip(2); var common = listA.Select(e => e.Id) .Intersect(listB.Select(e => e.Id));

Example code

var listA = employees.Take(3);
var listB = employees.Skip(2);
var common = listA.Select(e => e.Id)
.Intersect(listB.Select(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 onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id)…

Explain a bit more

Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id));

Example code

var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(e => e.Id)); var onlyInA = listA.Select(e => e.Id) .Except(listB.Select(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: Skip top 2 highest salaries and take next 2 var result = employees .OrderByDescending(e => e.Salary) .Skip(2) .Take(2); Skip top 2 highest salaries and take next 2 var result = employees .OrderByDescending(e => e.Salary) .Skip(2) .Take(2); Skip top 2 highest salaries and take next 2 var result = employees .OrderByDescending(e => e.Salary) .Skip(2) .Take(2);… Skip top 2 highest salaries and take next 2 var result =…

Explain a bit more

employees .OrderByDescending(e => e.Salary) .Skip(2) .Take(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: bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary >…

Example code

bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000); bool allHigh = employees.All(e => e.Salary > 50000);

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