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 1951–1975 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Left join with fallback message?

Short answer: Left join with fallback message var join = from d in departments join e in employees on d.Name equals e.Department into g from emp in g.DefaultIfEmpty() select new { Department = d.Name, Employee = emp?.Nam…

Mid PDF
Get 3rd highest salary using LINQ?

Short answer: Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e => e.Salary) .Skip(2) .FirstOrDefault(); Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e => e.…

Mid PDF
LINQ query to convert names to uppercase 🏁 Final Set (Q101–Q111)?

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

Mid PDF
LINQ query to convert names to uppercase?

Short answer: LINQ query to convert names to uppercase var upper = employees.Select(e => e.Name.ToUpper()); 🏁 Final Set (Q101–Q111) LINQ query to convert names to uppercase var upper = employees.Select(e => e.Name…

Mid PDF
Extract names and first letters e.Name[0] });?

Short answer: var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var resu…

Mid PDF
Extract names and first letters?

Short answer: Extract names and first letters var result = employees.Select(e => new { e.Name, FirstLetter = e.Name[0] }); Follow : Extract names and first letters var result = employees.Select(e => new { e.Name, F…

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…

LINQ LINQ Tutorial · LINQ

Short answer: Left join with fallback message var join = from d in departments join e in employees on d.Name equals e.Department into g from emp in g.DefaultIfEmpty() select new { Department = d.Name, Employee = emp?.Name ?? "No employee"

Real-world example (ShopNest)

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

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

Short answer: Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e => e.Salary) .Skip(2) .FirstOrDefault(); Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e => e.Salary) .Skip(2) .FirstOrDefault(); Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e => e.Salary) .Skip(2) .FirstOrDefault(); Get… 3rd highest salary using LINQ var third = employees…

Explain a bit more

OrderByDescending(e => e.Salary) .Skip(2) .FirstOrDefault();

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

Example code

var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper()); var upper = employees.Select(e => e.Name.ToUpper());

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: LINQ query to convert names to uppercase var upper = employees.Select(e => e.Name.ToUpper()); 🏁 Final Set (Q101–Q111) LINQ query to convert names to uppercase var upper = employees.Select(e => e.Name.ToUpper()); 🏁 Final Set (Q101–Q111) LINQ query to convert names to uppercase var upper = employees.Select(e => e.Name.ToUpper()); 🏁 Final Set (Q101–Q111)… LINQ query to convert names to uppercase var upper =…

Explain a bit more

employees.Select(e => e.Name.ToUpper()); 🏁 Final Set (Q101–Q111)

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 result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new {…

Explain a bit more

e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter =

Example code

var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter = var result = employees.Select(e => new { e.Name, FirstLetter =

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: Extract names and first letters var result = employees.Select(e => new { e.Name, FirstLetter = e.Name[0] }); Follow : Extract names and first letters var result = employees.Select(e => new { e.Name, FirstLetter = e.Name[0] }); Follow : Extract names and first letters var result = employees.Select(e => new { e.Name, FirstLetter = e.Name[0] }); Follow :… Extract names and first letters var result = employees.Select(e…

Explain a bit more

=> new { e.Name, FirstLetter = e.Name[0] }); Follow :

Real-world example (ShopNest)

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

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

LINQ LINQ Tutorial · LINQ

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