Basic LINQ Questions
-
What is LINQ in .NET and why is it used in ASP.NET Core applications?
-
Explain the difference between LINQ to Objects, LINQ to SQL, and LINQ to Entities (EF Core).
-
What are deferred execution and immediate execution in LINQ? Give examples.
-
What are query syntax and method syntax in LINQ?
-
What is the difference between
Select
andSelectMany
? -
What is the difference between
Where
andFirstOrDefault
? -
Explain the difference between
Single
,SingleOrDefault
,First
, andFirstOrDefault
. -
What is the difference between
Any()
andAll()
? -
What is the difference between
Count()
andLongCount()
? -
How do you perform joins using LINQ (inner join, group join, left join)?
Intermediate LINQ in ASP.NET Core
-
How does LINQ deferred execution impact database queries in EF Core?
-
What is the difference between
IQueryable<T>
andIEnumerable<T>
? -
What is the use of
AsEnumerable()
,AsQueryable()
, andToList()
? -
How does
GroupBy
work in LINQ? Can you group on multiple keys? -
What is the difference between
OrderBy
,ThenBy
, andThenByDescending
? -
How do you implement pagination using LINQ (
Skip
andTake
)? -
What is the difference between
Join
andGroupJoin
? -
How do you project custom objects using LINQ (
select new { }
)? -
How do you filter data with complex conditions in LINQ?
-
What is the difference between
Distinct
,Union
,Intersect
, andExcept
?
Advanced LINQ in ASP.NET Core
-
How does LINQ-to-Entities translate queries into SQL in EF Core?
-
What is the impact of using
ToList()
too early in a LINQ query? -
How do you handle N+1 query problems in LINQ with EF Core?
-
What is the difference between
Include()
andThenInclude()
in EF Core LINQ queries? -
Explain lazy loading vs eager loading vs explicit loading in EF Core LINQ.
-
How does
Select
projection help improve performance in LINQ queries? -
What are expression trees in LINQ?
-
What is the difference between
IQueryable.Provider
andIEnumerable
execution? -
How does LINQ handle deferred execution with closures?
-
How do you debug EF Core LINQ queries to see generated SQL?
Performance & Best Practices
-
How do you optimize LINQ queries in ASP.NET Core EF Core?
-
Why is
Any()
preferred overCount() > 0
in LINQ? -
Why should you avoid
ToList()
in the middle of a query chain? -
What is the difference between client-side evaluation and server-side evaluation in EF Core LINQ?
-
How do you implement bulk inserts/updates in EF Core without iterating LINQ queries?
-
How do you use AsNoTracking() in EF Core LINQ queries and why?
-
When should you use
CompiledQuery
in EF Core LINQ? -
How does deferred execution impact memory usage in ASP.NET Core APIs?
-
What is the difference between synchronous (
ToList
) and asynchronous (ToListAsync
) LINQ queries? -
How do you handle complex filtering dynamically using LINQ in ASP.NET Core APIs?
Additional LINQ Questions (Advanced + Practical)
-
What is the difference between
Select
andSelectMany
with examples? -
How do you perform a left outer join in LINQ?
-
How do you write a LINQ query to get the second highest salary from a table?
-
What is the difference between
Take
,TakeWhile
,Skip
, andSkipWhile
? -
How do you implement paging with sorting using LINQ in EF Core?
-
What is the difference between
DefaultIfEmpty
andFirstOrDefault
? -
How do you use Aggregate function in LINQ? Give an example.
-
How do you find duplicates in a collection using LINQ?
-
How do you remove duplicates using LINQ (
Distinct
vsGroupBy
)? -
What is the difference between
Concat
,Union
,Intersect
, andExcept
in LINQ? -
How do you perform a cross join in LINQ?
-
What is the difference between
Max
,Min
,Average
, andAggregate
? -
How do you get the nth element in a LINQ query safely?
-
How do you combine multiple predicates dynamically in LINQ (like filters in search APIs)?
-
What is the difference between deferred execution and lazy evaluation in LINQ?
-
What is the purpose of the
let
keyword in LINQ query syntax? -
How do you execute raw SQL queries with LINQ in EF Core?
-
What is the difference between
AsEnumerable()
andToList()
in LINQ queries? -
What is the difference between navigation property loading and
Join
in LINQ with EF Core? -
How do you handle NullReferenceException in LINQ queries safely?
-
How does
GroupJoin
differ fromGroupBy
? -
What is the difference between
All()
,Any()
, andContains()
in LINQ? -
How do you fetch hierarchical data (tree structure) using LINQ?
-
How do you convert LINQ queries into expression trees and compile them?
-
What is the difference between compiled queries in EF Core vs normal LINQ queries?
-
How do you write a LINQ query for dynamic sorting based on column name?
-
How do you write a LINQ query that performs string search with case-insensitivity?
-
How does
Include()
affect LINQ query performance in EF Core? -
What is the difference between
ThenBy
andThenByDescending
? -
How do you optimize a LINQ query that returns large result sets in ASP.NET Core APIs?
No comments:
Post a Comment