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 2651–2675 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Find employees in 'IT' with salary > 80k?

Short answer: var itHighEarners = employees .Where(e => e.Department == "IT" && e.Salary > 80000); Example code var itHighEarners = employees .Where(e => e.Department == "IT" &&am…

Mid PDF
Skip first and last employee?

Short answer: Skip first and last employee var middle = employees .Skip(1) .Take(employees.Count - 2); Follow : Skip first and last employee var middle = employees .Skip(1) .Take(employees.Count - 2); Follow : Skip first…

Mid PDF
Find median salary (approx) s).ToList();?

Short answer: (salaries[salaries.Count / 2 - 1] + salaries[salaries.Count / 2]) / 2 : salaries[salaries.Count / 2]; var salaries = employees.Select(e => e.Salary).OrderBy(s => double median = salaries.Count % 2 ==…

Mid PDF
Find median salary (approx)?

Short answer: Find median salary (approx) var salaries = employees.Select(e => e.Salary).OrderBy(s => s).ToList(); double median = salaries.Count % 2 == 0 ? (salaries[salaries.Count / 2 - 1] + salaries[salaries.Cou…

Mid PDF
Use SelectMany to flatten nested collections new() { "A", "B" }, new() { "C", "D" } };?

Short answer: var nested = new List<List<string>> { var flat = nested.SelectMany(x => x); Example code var nested = new List<List<string>> { var flat = nested.SelectMany(x => x); Real-world…

Mid PDF
Use SelectMany to flatten nested collections?

Short answer: Use SelectMany to flatten nested collections var nested = new List<List<string>> { new() { "A", "B" }, new() { "C", "D" } var flat = nested.SelectMany(x =…

Mid PDF
Match employees with same salary .GroupBy(e => e.Salary) .Where(g => g.Count() > 1)?

Short answer: var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); va…

Mid PDF
Match employees with same salary?

Short answer: Match employees with same salary var duplicates = employees .GroupBy(e => e.Salary) .Where(g => g.Count() > 1) .SelectMany(g => g); Match employees with same salary var duplicates = employees .G…

Mid PDF
How to safely use First() with fallback

Short answer: var emp = employees.FirstOrDefault(e => e.Name == "Unknown") ?? new Employee { Name = "Default" }; Example code var emp = employees.FirstOrDefault(e => e.Name == "Unknown&quot…

Mid PDF
Replace foreach with LINQ ✅ This is not LINQ but syntactic sugar with List<T>.ForEach.?

Short answer: employees.ForEach(e =&gt; Console.WriteLine(e.Name)); employees.ForEach(e =&gt; Console.WriteLine(e.Name)); employees.ForEach(e =&gt; Console.WriteLine(e.Name)); employees.ForEach(e =&gt; Console.WriteLine(…

Mid PDF
Replace foreach with LINQ?

Short answer: Replace foreach with LINQ employees.ForEach(e =&gt; Console.WriteLine(e.Name)); Follow : ✅ This is not LINQ but syntactic sugar with List&lt;T&gt;.ForEach. Explain a bit more Replace foreach with LINQ emplo…

Mid PDF
Convert list to dictionary with name as key?

Short answer: var dict = employees.ToDictionary(e =&gt; e.Name, e =&gt; e); var dict = employees.ToDictionary(e =&gt; e.Name, e =&gt; e); var dict = employees.ToDictionary(e =&gt; e.Name, e =&gt; e); var dict = employees…

Mid PDF
Left join with fallback message 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" };

Short answer: var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join…

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 =&gt; e.Salary) .Skip(2) .FirstOrDefault(); Get 3rd highest salary using LINQ var third = employees .OrderByDescending(e =&gt; e.…

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

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

Mid PDF
LINQ query to convert names to uppercase?

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

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

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

Mid PDF
Partition employees based on salary threshold?

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

Mid PDF
Check if department exists in list?

Short answer: bool exists = departments.Any(d =&gt; d.Name == &quot;Marketing&quot;); bool exists = departments.Any(d =&gt; d.Name == &quot;Marketing&quot;); bool exists = departments.Any(d =&gt; d.Name == &quot;Marketin…

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

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

Mid PDF
Get distinct list of department names?

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

Mid PDF
Generate custom formatted strings?

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

LINQ LINQ Tutorial · LINQ

Short answer: var itHighEarners = employees .Where(e => e.Department == "IT" && e.Salary > 80000);

Example code

var itHighEarners = employees
.Where(e => e.Department == "IT" && 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: Skip first and last employee var middle = employees .Skip(1) .Take(employees.Count - 2); Follow : Skip first and last employee var middle = employees .Skip(1) .Take(employees.Count - 2); Follow : Skip first and last employee var middle = employees .Skip(1) .Take(employees.Count - 2); Follow : Skip first and last employee var middle = employees .Skip(1)…

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: (salaries[salaries.Count / 2 - 1] + salaries[salaries.Count / 2]) / 2 : salaries[salaries.Count / 2]; var salaries = employees.Select(e => e.Salary).OrderBy(s => double median = salaries.Count % 2 == 0

Real-world example (ShopNest)

ShopNest builds a LINQ query for search filters, then calls ToListAsync() once in the repository—so the SQL runs one time, not inside a loop.

Say this in the interview

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

LINQ LINQ Tutorial · LINQ

Short answer: Find median salary (approx) var salaries = employees.Select(e => e.Salary).OrderBy(s => s).ToList(); double median = salaries.Count % 2 == 0 ? (salaries[salaries.Count / 2 - 1] + salaries[salaries.Count / 2]) / 2 : salaries[salaries.Count / 2]; Find median salary (approx) var salaries = employees.Select(e => e.Salary).OrderBy(s => s).ToList(); double median = salaries.Count % 2 == 0 ?

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 nested = new List<List<string>> { var flat = nested.SelectMany(x => x);

Example code

var nested = new List<List<string>> {
var flat = nested.SelectMany(x => x);

Real-world example (ShopNest)

ShopNest maps entities to DTOs with .Select(o => new OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields.

Say this in the interview

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

LINQ LINQ Tutorial · LINQ

Short answer: Use SelectMany to flatten nested collections var nested = new List<List<string>> { new() { "A", "B" }, new() { "C", "D" } var flat = nested.SelectMany(x => x); Use SelectMany to flatten nested collections var nested = new List<List<string>> { new() { "A", "B" }, new() { "C", "D" } var flat = nested.SelectMany(x => x); Real-world… example (ShopNest)… ShopNest… maps entities to DTOs with .Select(o => new…

Explain a bit more

OrderSummaryDto { Id = o.Id, Total = o.Total }) so the API does not leak internal fields. Use SelectMany to flatten nested collections var nested = new List<List<string>> { new() { "A", "B" }, new() { "C", "D" } var flat = nested.SelectMany(x => x); Use SelectMany to flatten nested collections var nested = new List<List<string>> { new() { "A", "B" }, new() { "C", "D" } var flat = nested.SelectMany(x => x); 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 duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g);

Example code

var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g); var duplicates = employees .SelectMany(g => g);

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: Match employees with same salary var duplicates = employees .GroupBy(e => e.Salary) .Where(g => g.Count() > 1) .SelectMany(g => g); Match employees with same salary var duplicates = employees .GroupBy(e => e.Salary) .Where(g => g.Count() > 1) .SelectMany(g => g); Match employees with same salary var duplicates = employees .GroupBy(e => e.Salary) .Where(g =>… g.Count() > 1) .SelectMany(g => g); Match employees with…

Explain a bit more

same salary var duplicates = employees .GroupBy(e => e.Salary) .Where(g => g.Count() > 1) .SelectMany(g => g);

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 emp = employees.FirstOrDefault(e => e.Name == "Unknown") ?? new Employee { Name = "Default" };

Example code

var emp = employees.FirstOrDefault(e => e.Name == "Unknown") ?? new
Employee { Name = "Default" };

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: employees.ForEach(e => Console.WriteLine(e.Name)); employees.ForEach(e => Console.WriteLine(e.Name)); employees.ForEach(e => Console.WriteLine(e.Name)); employees.ForEach(e => Console.WriteLine(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: Replace foreach with LINQ employees.ForEach(e => Console.WriteLine(e.Name)); Follow : ✅ This is not LINQ but syntactic sugar with List<T>.ForEach.

Explain a bit more

Replace foreach with LINQ employees.ForEach(e => Console.WriteLine(e.Name)); Follow : ✅ This is not LINQ but syntactic sugar with List<T>.ForEach. Replace foreach with LINQ employees.ForEach(e => Console.WriteLine(e.Name)); Follow : ✅ This is not LINQ but syntactic sugar with List<T>.ForEach. Replace foreach with LINQ employees.ForEach(e => Console.WriteLine(e.Name)); Follow : ✅ This is not LINQ but syntactic sugar with List<T>.ForEach.

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 dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict =…

Explain a bit more

employees.ToDictionary(e => e.Name, e => e);

Example code

var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => e); var dict = employees.ToDictionary(e => e.Name, e => 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 join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments

Example code

var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments var join = from d in departments

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