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 2676–2700 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Group and sort within group?

Short answer: Group and sort within group var groupSort = employees .GroupBy(e => e.Department) .Select(g => new { Dept = g.Key, Emp = g.OrderBy(e => e.Name) }); Follow : Group and sort within group var groupSor…

Mid PDF
Compare two lists of employees?

Short answer: Compare two lists of employees bool same = list1.Select(e => e.Id).SequenceEqual(list2.Select(e => e.Id)); Compare two lists of employees bool same = list1.Select(e => e.Id).SequenceEqual(list2.Sel…

Mid PDF
Filter employees with salary in specific set?

Short answer: var filterSalaries = new[] { 60000, 80000 }; var match = employees.Where(e => filterSalaries.Contains(e.Salary)); Example code var filterSalaries = new[] { 60000, 80000 }; var match = employees.Where(e =…

Mid PDF
Convert to dictionary with Id and Name?

Short answer: var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.…

Mid PDF
Replace empty departments with “Unassigned” e.Name, Department = string.IsNullOrEmpty(e.Department)?

Short answer: var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Se…

Mid PDF
Replace empty departments with “Unassigned”?

Short answer: Replace empty departments with “Unassigned” var updated = employees.Select(e => new { e.Name, Department = string.IsNullOrEmpty(e.Department) ? Explain a bit more "Unassigned" : e.Department })…

Mid PDF
How to perform a cross join with LINQ?

Short answer: var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in…

Mid PDF
How to perform a cross join with LINQ?

Short answer: How to perform a cross join with LINQ? var crossJoin = from e in employees from d in departments select new { Employee = e.Name, Department = d.Name Explanation: Cross join pairs every employee with every d…

Mid PDF
How to use LINQ to XML to query XML data?

Short answer: XDocument doc = XDocument.Parse(xml); var names = doc.Descendants("Employee") .Select(x => x.Element("Name")?.Value); Example code XDocument doc = XDocument.Parse(xml); var names = do…

Mid PDF
How to use LINQ to XML to query XML data?

Short answer: How to use LINQ to XML to query XML data? Explain a bit more using System.Xml.Linq; string xml = @"<Employees> <Employee Id='1'><Name>Alice</Name></Employee> <Employee…

Mid PDF
How to perform a left outer join in LINQ?

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

Mid PDF
How to perform a left outer join in LINQ?

Short answer: How to perform a left outer join in LINQ? var leftJoin = from d in departments join e in employees on d.Name equals e.Department into empGroup from emp in empGroup.DefaultIfEmpty() select new { Department =…

Mid PDF
How to use LINQ with asynchronous streams?

Short answer: for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1…

Mid PDF
How to use LINQ with asynchronous streams?

Short answer: How to use LINQ with asynchronous streams? Explain a bit more using System.Threading.Tasks; using System.Linq; using System.Collections.Generic; Follow : async IAsyncEnumerable<int> GenerateNumbersAsy…

Mid PDF
How to query JSON data using LINQ?

Short answer: JsonArray arr = JsonNode.Parse(json).AsArray(); var names = arr.Select(node => node["Name"].GetValue<string>()); Example code JsonArray arr = JsonNode.Parse(json).AsArray(); var names = a…

Mid PDF
How to query JSON data using LINQ?

Short answer: How to query JSON data using LINQ? using System.Text.Json; using System.Text.Json.Nodes; string json = @"[{""Name"":""Alice"",""Age"":30},{&q…

Mid PDF
How to filter distinct objects by a property?

Short answer: var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employee…

Mid PDF
How to filter distinct objects by a property?

Short answer: How to filter distinct objects by a property? var distinctByDept = employees .GroupBy(e => e.Department) .Select(g => g.First()); Explanation: Groups employees by department and selects one employee f…

Mid PDF
How to calculate running totals using LINQ?

Short answer: foreach (var total in runningTotals) Console.WriteLine(total); Explanation: Accumulates sums as you iterate through the sequence. var salaries = employees.Select(e => e.Salary).ToList(); Example code dou…

Mid PDF
How to calculate running totals using LINQ?

Short answer: How to calculate running totals using LINQ? var salaries = employees.Select(e => e.Salary).ToList(); double runningTotal = 0; var runningTotals = salaries.Select(s => runningTotal += s); foreach (var…

Mid PDF
How to perform conditional LINQ queries?

Short answer: if (!string.IsNullOrEmpty(searchName)) { } Explanation: Build LINQ queries dynamically based on conditions. string searchName = "Alice"; var query = employees.AsQueryable(); query = query.Where(e…

Mid PDF
How to perform conditional LINQ queries?

Short answer: How to perform conditional LINQ queries? string searchName = "Alice"; var query = employees.AsQueryable(); if (!string.IsNullOrEmpty(searchName)) query = query.Where(e => e.Name.Contains(search…

Mid PDF
How to flatten hierarchical data with SelectMany?

Short answer: { new { Department = "IT", Employees = new [] {"Bob", "Charlie"} }, new { Department = "HR", Employees = new [] {"Alice", "Eva"} } }; foreach (var…

Mid PDF
How to flatten hierarchical data with SelectMany?

Short answer: How to flatten hierarchical data with SelectMany? Explain a bit more var departmentsWithEmployees = new[] new { Department = "IT", Employees = new [] {"Bob", "Charlie"} new { D…

Mid PDF
How to group join with multiple collections?

Short answer: var groupJoin = from d in departments into empGroup var groupJoin = from d in departments into empGroup var groupJoin = from d in departments into empGroup var groupJoin = from d in departments into empGrou…

LINQ LINQ Tutorial · LINQ

Short answer: Group and sort within group var groupSort = employees .GroupBy(e => e.Department) .Select(g => new { Dept = g.Key, Emp = g.OrderBy(e => e.Name) }); Follow : Group and sort within group var groupSort = employees .GroupBy(e => e.Department) .Select(g => new { Dept = g.Key, Emp = g.OrderBy(e => e.Name) }); Follow : Real-world example… (ShopNest) A sales… report… joins orders and customers, then GroupBy(c => c.City) to…

Explain a bit more

show revenue per city. Group and sort within group var groupSort = employees .GroupBy(e => e.Department) .Select(g => new { Dept = g.Key, Emp = g.OrderBy(e => e.Name) }); Follow : Group and sort within group var groupSort = employees .GroupBy(e => e.Department) .Select(g => new { Dept = g.Key, Emp = g.OrderBy(e => e.Name) }); Follow : 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: Compare two lists of employees bool same = list1.Select(e => e.Id).SequenceEqual(list2.Select(e => e.Id)); Compare two lists of employees bool same = list1.Select(e => e.Id).SequenceEqual(list2.Select(e => e.Id)); Compare two lists of employees bool same = list1.Select(e => e.Id).SequenceEqual(list2.Select(e => e.Id)); Compare two lists of employees bool… same = list1.Select(e => e.Id).SequenceEqual(list2.Select(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 filterSalaries = new[] { 60000, 80000 }; var match = employees.Where(e => filterSalaries.Contains(e.Salary));

Example code

var filterSalaries = new[] { 60000, 80000 };
var match = employees.Where(e => filterSalaries.Contains(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: var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict =…

Explain a bit more

employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name);

Example code

var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => e.Name); var idNameDict = employees.ToDictionary(e => e.Id, e => 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: var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new {

Example code

var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new { var updated = employees.Select(e => new {

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: Replace empty departments with “Unassigned” var updated = employees.Select(e => new { e.Name, Department = string.IsNullOrEmpty(e.Department) ?

Explain a bit more

"Unassigned" : e.Department }); Replace empty departments with “Unassigned” var updated = employees.Select(e => new { e.Name, Department = string.IsNullOrEmpty(e.Department) ? "Unassigned" : e.Department }); Replace empty departments with “Unassigned” var updated = employees.Select(e => new { e.Name, Department = string.IsNullOrEmpty(e.Department) ? "Unassigned" : e.Department }); Replace empty departments with “Unassigned” var updated = employees.Select(e => new { e.Name, Department = string.IsNullOrEmpty(e.Department) ? "Unassigned" : e.Department });

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 crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees

Example code

var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees var crossJoin = from e in employees

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: How to perform a cross join with LINQ? var crossJoin = from e in employees from d in departments select new { Employee = e.Name, Department = d.Name Explanation: Cross join pairs every employee with every department. Useful for generating all combinations, e.g., for testing or creating matrices. Follow :

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: XDocument doc = XDocument.Parse(xml); var names = doc.Descendants("Employee") .Select(x => x.Element("Name")?.Value);

Example code

XDocument doc = XDocument.Parse(xml);
var names = doc.Descendants("Employee")
.Select(x => x.Element("Name")?.Value);

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 use LINQ to XML to query XML data?

Explain a bit more

using System.Xml.Linq; string xml = @"<Employees> <Employee Id='1'><Name>Alice</Name></Employee> <Employee Id='2'><Name>Bob</Name></Employee> </Employees>"; XDocument doc = XDocument.Parse(xml); var names = doc.Descendants("Employee") .Select(x => x.Element("Name")?.Value); foreach (var name in names) Console.WriteLine(name); Explanation: LINQ to XML provides an elegant way to query and manipulate XML data as 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 leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup var leftJoin = from d in departments into empGroup

Example code

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

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: How to perform a left outer join in LINQ? var leftJoin = from d in departments join e in employees on d.Name equals e.Department into empGroup from emp in empGroup.DefaultIfEmpty() select new { Department = d.Name, EmployeeName = emp?.Name ??

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 (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++)

Example code

for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++) for (int i = 1; i <= 5; i++)

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 use LINQ with asynchronous streams?

Explain a bit more

using System.Threading.Tasks; using System.Linq; using System.Collections.Generic; Follow : async IAsyncEnumerable<int> GenerateNumbersAsync() for (int i = 1; i <= 5; i++) await Task.Delay(100); yield return i; async Task ExampleAsync() await foreach (var number in GenerateNumbersAsync().Where(n => n % 2 == 0)) Console.WriteLine(number); Explanation: Combine LINQ with asynchronous streams to filter async data efficiently.

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: JsonArray arr = JsonNode.Parse(json).AsArray(); var names = arr.Select(node => node["Name"].GetValue<string>());

Example code

JsonArray arr = JsonNode.Parse(json).AsArray();
var names = arr.Select(node => node["Name"].GetValue<string>());

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 query JSON data using LINQ? using System.Text.Json; using System.Text.Json.Nodes; string json = @"[{""Name"":""Alice"",""Age"":30},{""Name"":""Bob"",""Age"":25}]"; JsonArray arr = JsonNode.Parse(json).AsArray(); var names = arr.Select(node => node["Name"].GetValue<string>()); foreach (var name in names) Console.WriteLine(name); Follow :… Explanation:…… Use System.Text.Json to parse JSON, then LINQ to query…

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 distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept =…

Example code

var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First()); var distinctByDept = employees .Select(g => g.First());

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: How to filter distinct objects by a property? var distinctByDept = employees .GroupBy(e => e.Department) .Select(g => g.First()); Explanation: Groups employees by department and selects one employee from each group to get distinct departments.

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: foreach (var total in runningTotals) Console.WriteLine(total); Explanation: Accumulates sums as you iterate through the sequence. var salaries = employees.Select(e => e.Salary).ToList();

Example code

double runningTotal = 0;
var runningTotals = salaries.Select(s => runningTotal += 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: How to calculate running totals using LINQ? var salaries = employees.Select(e => e.Salary).ToList(); double runningTotal = 0; var runningTotals = salaries.Select(s => runningTotal += s); foreach (var total in runningTotals) Console.WriteLine(total); Explanation: Accumulates sums as you iterate through the sequence.

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: if (!string.IsNullOrEmpty(searchName)) { } Explanation: Build LINQ queries dynamically based on conditions. string searchName = "Alice"; var query = employees.AsQueryable(); query = query.Where(e => e.Name.Contains(searchName)); var result = query.ToList();

Example code

if (!string.IsNullOrEmpty(searchName)) { } Explanation: Build LINQ queries dynamically based on conditions. string searchName = "Alice";
var query = employees.AsQueryable();
query = query.Where(e => e.Name.Contains(searchName));
var result = query.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 perform conditional LINQ queries? string searchName = "Alice"; var query = employees.AsQueryable(); if (!string.IsNullOrEmpty(searchName)) query = query.Where(e => e.Name.Contains(searchName)); var result = query.ToList(); Follow : Explanation: Build LINQ queries dynamically based on conditions. How to perform conditional LINQ queries? string…… searchName = "Alice"; var query = employees.AsQueryable(); if…

Explain a bit more

(!string.IsNullOrEmpty(searchName)) query = query.Where(e => e.Name.Contains(searchName)); var result = query.ToList(); Follow : Explanation: Build LINQ queries dynamically based on conditions.

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: { new { Department = "IT", Employees = new [] {"Bob", "Charlie"} }, new { Department = "HR", Employees = new [] {"Alice", "Eva"} } }; foreach (var emp in allEmployees) Console.WriteLine(emp); Explanation: SelectMany flattens nested collections into a single sequence. var departmentsWithEmployees = new[]

Example code

var allEmployees = departmentsWithEmployees
.SelectMany(d => d.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: How to flatten hierarchical data with SelectMany?

Explain a bit more

var departmentsWithEmployees = new[] new { Department = "IT", Employees = new [] {"Bob", "Charlie"} new { Department = "HR", Employees = new [] {"Alice", "Eva"} } var allEmployees = departmentsWithEmployees .SelectMany(d => d.Employees); foreach (var emp in allEmployees) Console.WriteLine(emp); Explanation: SelectMany flattens nested collections into a single sequence.

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

Example code

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

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