Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 26–50 of 100

Popular tracks

Mid PDF
How does EF Core detect changes in entity properties? EF Core tracks changes via: ● Snapshot change tracking: EF stores a snapshot of original values when entities

Answer: re loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, EF can track changes immediately. EF compares the current values to the original snapshot during SaveC…

EF Core Read answer
Mid PDF
How does EF Core detect changes in entity properties?

EF Core tracks changes via: Snapshot change tracking: EF stores a snapshot of original values when entities are loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, E…

EF Core Read answer
Mid PDF
How to disable change tracking globally?

Answer: You can disable tracking by default for a specific DbContext using: optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrac king); Or per-query using .AsNoTracking(). What interviewers expect A clear…

EF Core Read answer
Mid PDF
How to manually mark an entity as Modified / Detached etc.?

Use the Entry() method: context.Entry(entity).State = EntityState.Modified; context.Entry(entity).State = EntityState.Detached; This is helpful when: You’re updating data without reloading it Working with disconnected sc…

EF Core Read answer
Mid PDF
How is concurrency handled?

What is optimistic concurrency vs pessimistic concurrency? Optimistic concurrency: Assumes that conflicts are rare. EF checks for changes before saving using concurrency tokens. Pessimistic concurrency: Locks records in…

EF Core Read answer
Mid PDF
What are the types of relationships in relational databases?

EF Core supports the standard types of relationships: One-to-One (1:1) – One entity has one related entity. One-to-Many (1:N) – One entity relates to many others. Many-to-Many (M:N) – Many entities relate to many others.…

EF Core Read answer
Mid PDF
How to configure a one-to-one relationship in EF Core?

Example using Fluent API: modelBuilder.Entity<User>() .HasOne(u => u.Profile) .WithOne(p => p.User) .HasForeignKey<Profile>(p => p.UserId); Or with data annotations: public class Profile { [Key, Fore…

EF Core Read answer
Mid PDF
How to configure a one-to-many relationship?

Fluent API: modelBuilder.Entity<Blog>() .HasMany(b => b.Posts) .WithOne(p => p.Blog) .HasForeignKey(p => p.BlogId); Data annotations: public class Post { public int BlogId { get; set; } [ForeignKey("BlogId…

EF Core Read answer
Mid PDF
How to configure many-to-many (EF Core 5+)?

In EF Core 5.0+, you can define many-to-many relationships without an explicit join entity: public class Student { public ICollection<Course> Courses { get; set; } } public class Course { public ICollection<Stud…

EF Core Read answer
Mid PDF
What are join tables / linking tables? How to represent them in EF Core?

join table maps a many-to-many relationship. In EF Core: ✅ Auto-created (EF Core 5+): If you define many-to-many with ICollection<T>, EF creates the join table. 🛠 Manual (custom join entity): public class StudentC…

EF Core Read answer
Mid PDF
What are join tables / linking tables?

How to represent them in EF Core? A join table maps a many-to-many relationship. In EF Core: ✅ Auto-created (EF Core 5+): If you define many-to-many with ICollection<T>, EF creates the join table. 🛠 Manual (custom…

EF Core Read answer
Mid PDF
What are foreign keys and primary keys?

How to define them via annotations & Fluent API? Primary Key (PK): Unique identifier of a record. Foreign Key (FK): A field that references a PK in another table. Data Annotations: [Key] public int Id { get; set; } […

EF Core Read answer
Mid PDF
What are shadow keys / foreign keys?

shadow property is a property not defined in the .NET class but exists in the EF model. Example: modelBuilder.Entity<Post>() .HasOne<Blog>() .WithMany() .HasForeignKey("BlogId"); // BlogId is a shadow FK if n…

EF Core Read answer
Mid PDF
How to handle required vs optional relationships?

In Fluent API: Required: .HasRequired(p => p.Blog) Optional: .HasOne(p => p.Blog) .WithMany() .IsRequired(false); EF infers: Reference type (e.g., Blog) → optional by default Non-nullable value type FK (e.g., int B…

EF Core Read answer
Mid PDF
What performance implications are there for eager vs lazy loading?

Loading Type Pros Cons Eager Fewer queries, good for large data sets Loads everything even if not used Lazy Loads only when needed Risk of N+1 queries, more round-trips Explicit Fine-grained control More code complexity…

EF Core Read answer
Mid PDF
Can you disable lazy loading? How?

Answer: Yes. You can disable lazy loading globally: options.UseLazyLoadingProxies(false); Or don't install the proxy package at all. You can also disable it for specific navigation properties by not making them virtual.…

EF Core Read answer
Mid PDF
Can you disable lazy loading?

Answer: How? Yes. You can disable lazy loading globally: options.UseLazyLoadingProxies(false); Or don't install the proxy package at all. You can also disable it for specific navigation properties by not making them virt…

EF Core Read answer
Mid PDF
How does LINQ translate to SQL? What limitations are there?

EF Core translates LINQ queries into SQL using expression trees. Only supported LINQ operators and expressions can be translated. Limitations: Certain C# methods or complex expressions cannot be translated and cause runt…

EF Core Read answer
Mid PDF
How does LINQ translate to SQL?

What limitations are there? EF Core translates LINQ queries into SQL using expression trees. Only supported LINQ operators and expressions can be translated. Limitations: Certain C# methods or complex expressions cannot…

EF Core Read answer
Mid PDF
Difference between IQueryable<T> and IEnumerable<T> in EF Core.?

IQueryable&lt;T&gt;: Represents a query against the data source. Query is translated to SQL and executed on the database. Supports deferred execution. IEnumerable&lt;T&gt;: Represents an in-memory collection. LINQ operat…

EF Core Read answer
Mid PDF
How to write joins (inner, left) in LINQ with EF Core?

Inner join example: var query = from c in context.Customers join o in context.Orders on c.Id equals o.CustomerId select new { c.Name, o.OrderDate }; Left join (using DefaultIfEmpty()): var query = from c in context.Custo…

EF Core Read answer
Mid PDF
How to do grouping, aggregation (Sum, Count, Max, Min) via LINQ?

var groupedData = context.Orders .GroupBy(o =&gt; o.CustomerId) .Select(g =&gt; new { CustomerId = g.Key, TotalOrders = g.Count(), TotalAmount = g.Sum(o =&gt; o.Amount), MaxAmount = g.Max(o =&gt; o.Amount), MinAmount = g…

EF Core Read answer
Mid PDF
How to do filtering (Where), ordering (OrderBy, ThenBy, OrderByDescending)?

Answer: Filtering: var filtered = context.Products.Where(p =&amp;gt; p.Price &amp;gt; 100); Ordering: var ordered = context.Products .OrderBy(p =&amp;gt; p.Category) .ThenByDescending(p =&amp;gt; p.Price); What interview…

EF Core Read answer
Mid PDF
How to use First, FirstOrDefault, Single, SingleOrDefault etc.?

First(): Returns the first element, throws if none found. FirstOrDefault(): Returns first element or default (null) if none. Single(): Returns the single element, throws if zero or more than one. SingleOrDefault(): Retur…

EF Core Read answer
Mid PDF
What about pagination? (Skip, Take)

Answer: Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p =&amp;gt; p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList(); What interviewers expect A clear definition tied to…

EF Core Read answer

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: re loaded, and compares them before saving. Notifications: If your entities implement INotifyPropertyChanged, EF can track changes immediately. EF compares the current values to the original snapshot during SaveChanges().

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

EF Core tracks changes via:

  • Snapshot change tracking: EF stores a snapshot of original values when entities

are loaded, and compares them before saving.

  • Notifications: If your entities implement INotifyPropertyChanged, EF can track

changes immediately.

EF compares the current values to the original snapshot during SaveChanges().

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: You can disable tracking by default for a specific DbContext using: optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrac king); Or per-query using .AsNoTracking().

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Use the Entry() method:

context.Entry(entity).State = EntityState.Modified;
context.Entry(entity).State = EntityState.Detached;

This is helpful when:

  • You’re updating data without reloading it
  • Working with disconnected scenarios (e.g., APIs)
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

What is optimistic concurrency vs

pessimistic concurrency?

  • Optimistic concurrency: Assumes that conflicts are rare. EF checks for changes

before saving using concurrency tokens.

  • Pessimistic concurrency: Locks records in the DB to prevent other updates (not

supported out-of-the-box in EF Core).

EF Core supports optimistic concurrency using [ConcurrencyCheck] or

[Timestamp].

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

EF Core supports the standard types of relationships:

  • One-to-One (1:1) – One entity has one related entity.
  • One-to-Many (1:N) – One entity relates to many others.
  • Many-to-Many (M:N) – Many entities relate to many others.

Each of these can be configured in EF Core using navigation properties and Fluent API or

Data Annotations.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Example using Fluent API:

modelBuilder.Entity<User>()

.HasOne(u => u.Profile)

.WithOne(p => p.User)

.HasForeignKey<Profile>(p => p.UserId);

Or with data annotations:

public class Profile
{

[Key, ForeignKey("User")]

public int UserId { get; set; }
public User User { get; set; }
}
  • Requires a unique foreign key.
  • EF assumes optional by default unless marked as required.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Fluent API:

modelBuilder.Entity<Blog>()

.HasMany(b => b.Posts)

.WithOne(p => p.Blog)

.HasForeignKey(p => p.BlogId);

Data annotations:

public class Post
{
public int BlogId { get; set; }

[ForeignKey("BlogId")]

public Blog Blog { get; set; }
}
  • A foreign key exists in the many-side entity (Post).
  • EF infers this relationship from navigation + FK.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

In EF Core 5.0+, you can define many-to-many relationships without an explicit join entity:

public class Student
{
public ICollection<Course> Courses { get; set; }
}
public class Course
{
public ICollection<Student> Students { get; set; }
}

EF will automatically create a join table CourseStudent behind the scenes.

If you want to customize the join table, define a join entity explicitly.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

join table maps a many-to-many relationship. In EF Core:

✅ Auto-created (EF Core 5+):

If you define many-to-many with ICollection<T>, EF creates the join table.

🛠 Manual (custom join entity):

public class StudentCourse
{
public int StudentId { get; set; }
public Student Student { get; set; }
public int CourseId { get; set; }
public Course Course { get; set; }
}

nd configure with Fluent API.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

How to represent them in EF

Core?

A join table maps a many-to-many relationship. In EF Core:

✅ Auto-created (EF Core 5+):

If you define many-to-many with ICollection<T>, EF creates the join table.

🛠 Manual (custom join entity):

public class StudentCourse

public int StudentId { get; set; }

public Student Student { get; set; }

public int CourseId { get; set; }

public Course Course { get; set; }

And configure with Fluent API.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

How to define them via

annotations & Fluent API?

  • Primary Key (PK): Unique identifier of a record.
  • Foreign Key (FK): A field that references a PK in another table.

Data Annotations:

[Key]

public int Id { get; set; }

[ForeignKey("Blog")]

public int BlogId { get; set; }

Fluent API:

modelBuilder.Entity<Post>()

.HasKey(p => p.Id);

modelBuilder.Entity<Post>()

.HasOne(p => p.Blog)

.WithMany(b => b.Posts)

.HasForeignKey(p => p.BlogId);

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

shadow property is a property not defined in the .NET class but exists in the EF model.

Example:

modelBuilder.Entity<Post>()

.HasOne<Blog>()

.WithMany()

.HasForeignKey("BlogId"); // BlogId is a shadow FK if not

defined in class

EF tracks it internally but you can't access it in C# code directly.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

In Fluent API:

  • Required:

.HasRequired(p => p.Blog)

  • Optional:

.HasOne(p => p.Blog)

.WithMany()

.IsRequired(false);

EF infers:

  • Reference type (e.g., Blog) → optional by default
  • Non-nullable value type FK (e.g., int BlogId) → required

Entity Framework Core – Lazy vs

Eager vs Explicit Loading

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Loading

Type

Pros Cons

Eager Fewer queries, good for large data

sets

Loads everything even if not used

Lazy Loads only when needed Risk of N+1 queries, more

round-trips

Explicit Fine-grained control More code complexity

✅ Eager is best for performance when you know you'll need related data.

❌ Lazy can hurt performance unless used carefully (e.g., in UI apps).

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Yes. You can disable lazy loading globally: options.UseLazyLoadingProxies(false); Or don't install the proxy package at all. You can also disable it for specific navigation properties by not making them virtual.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: How? Yes. You can disable lazy loading globally: options.UseLazyLoadingProxies(false); Or don't install the proxy package at all. You can also disable it for specific navigation properties by not making them virtual.

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • EF Core translates LINQ queries into SQL using expression trees.
  • Only supported LINQ operators and expressions can be translated.
  • Limitations:
  • Certain C# methods or complex expressions cannot be translated and

cause runtime exceptions.

  • Client-side evaluation may occur, which can hurt performance.
  • Use .AsEnumerable() to switch to client-side processing intentionally.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

What limitations are there?

  • EF Core translates LINQ queries into SQL using expression trees.
  • Only supported LINQ operators and expressions can be translated.
  • Limitations:
  • Certain C# methods or complex expressions cannot be translated and

cause runtime exceptions.

  • Client-side evaluation may occur, which can hurt performance.
  • Use .AsEnumerable() to switch to client-side processing intentionally.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • IQueryable<T>:
  • Represents a query against the data source.
  • Query is translated to SQL and executed on the database.
  • Supports deferred execution.
  • IEnumerable<T>:
  • Represents an in-memory collection.
  • LINQ operators execute in memory.
  • Usually results after the query has executed and data is loaded.
Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • Inner join example:
var query = from c in context.Customers

join o in context.Orders on c.Id equals o.CustomerId

select new { c.Name, o.OrderDate };

  • Left join (using DefaultIfEmpty()):
var query = from c in context.Customers

join o in context.Orders on c.Id equals o.CustomerId

into orders

from o in orders.DefaultIfEmpty()

select new { c.Name, OrderDate = o != null ? o.OrderDate

: (DateTime?)null };

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

var groupedData = context.Orders

.GroupBy(o => o.CustomerId)

.Select(g => new

{

CustomerId = g.Key,

TotalOrders = g.Count(),

TotalAmount = g.Sum(o => o.Amount),

MaxAmount = g.Max(o => o.Amount),

MinAmount = g.Min(o => o.Amount)

});

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Filtering: var filtered = context.Products.Where(p =&gt; p.Price &gt; 100); Ordering: var ordered = context.Products .OrderBy(p =&gt; p.Category) .ThenByDescending(p =&gt; p.Price);

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

  • First(): Returns the first element, throws if none found.
  • FirstOrDefault(): Returns first element or default (null) if none.
  • Single(): Returns the single element, throws if zero or more than one.
  • SingleOrDefault(): Returns the single element or default if none; throws if more

than one.

Permalink & share

Entity Framework Core Entity Framework Core Tutorial · EF Core

Answer: Use .Skip() and .Take() for pagination: var page2 = context.Products .OrderBy(p =&gt; p.Id) .Skip(10) // Skip first 10 .Take(10) // Take next 10 .ToList();

What interviewers expect

  • A clear definition tied to EF Core in Entity Framework Core projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Entity Framework Core application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Entity Framework Core architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

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