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 126–150 of 219

Popular tracks

Mid PDF
Partition employees based on salary threshold?

Short answer: var high = employees.Where(e => e.Salary >= 80000); var low = employees.Where(e => e.Salary < 80000); Example code var high = employees.Where(e => e.Salary >= 80000); var low = employees.W…

Mid PDF
Check if department exists in list?

Short answer: bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketin…

Mid PDF
Select anonymous object with calculated tax e.Name, Tax = e.Salary * 0.1 });?

Short answer: var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e =&g…

Mid PDF
Select anonymous object with calculated tax?

Short answer: Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new {…

Mid PDF
Get distinct list of department names?

Short answer: var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var d…

Mid PDF
Generate custom formatted strings?

Short answer: var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $&quo…

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…

LINQ LINQ Tutorial · LINQ

Short answer: var high = employees.Where(e => e.Salary >= 80000); var low = employees.Where(e => e.Salary < 80000);

Example code

var high = employees.Where(e => e.Salary >= 80000);
var low = employees.Where(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: bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool…

Explain a bit more

exists = departments.Any(d => d.Name == "Marketing");

Example code

bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing"); bool exists = departments.Any(d => d.Name == "Marketing");

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 taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new { var taxed = employees.Select(e => new {

Example code

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

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: Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select… anonymous object with calculated tax var taxed =…

Explain a bit more

employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 });

Example code

Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select… anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 }); Select anonymous object with calculated tax var taxed = employees.Select(e => new { e.Name, Tax = e.Salary * 0.1 });

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 deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e…

Explain a bit more

=> e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct();

Example code

var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).Distinct(); var deptNames = employees.Select(e => e.Department).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: var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display…

Explain a bit more

= employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}");

Example code

var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{e.Salary}"); var display = employees.Select(e => $"{e.Name} earns ₹{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: 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
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