DbContext & Sets interview questions

21 real DbContext & Sets questions from the EF Core bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is DbContext?

Junior
  1. A.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  2. B.the overridable method where a context selects its provider and connection string when options are not injected externally
  3. C.the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
  4. D.the method that detects pending changes on tracked entities and writes them to the database within a single transaction
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.DbContext — the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
  2. B.DbContext — a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  3. C.DbContext — the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  4. D.DbContext — the primary class representing a session with the database, exposing entity collections and tracking changes to objects
Reveal the answer + AI explanation — free account

4. What is DbSet<T>?

Junior
  1. A.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  2. B.the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  3. C.a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  4. D.the overridable method where a context selects its provider and connection string when options are not injected externally
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.DbSet<T> — the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
  2. B.DbSet<T> — a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  3. C.DbSet<T> — the method that detects pending changes on tracked entities and writes them to the database within a single transaction
  4. D.DbSet<T> — the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
Reveal the answer + AI explanation — free account

7. What is unit of work?

Mid
  1. A.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  2. B.the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
  3. C.the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  4. D.a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
Reveal the answer + AI explanation — free account

8. Which term means: "the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation"?

Mid
  1. A.unit of work
  2. B.SaveChangesAsync
  3. C.OnConfiguring
  4. D.SaveChanges
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.unit of work — a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  2. B.unit of work — the overridable method where a context selects its provider and connection string when options are not injected externally
  3. C.unit of work — the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  4. D.unit of work — the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
Reveal the answer + AI explanation — free account

10. What is SaveChanges?

Junior
  1. A.the overridable method where a context selects its provider and connection string when options are not injected externally
  2. B.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  3. C.a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  4. D.the method that detects pending changes on tracked entities and writes them to the database within a single transaction
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Junior
  1. A.SaveChanges — the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
  2. B.SaveChanges — the method that detects pending changes on tracked entities and writes them to the database within a single transaction
  3. C.SaveChanges — the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
  4. D.SaveChanges — the overridable method where a context selects its provider and connection string when options are not injected externally
Reveal the answer + AI explanation — free account

13. What is SaveChangesAsync?

Mid
  1. A.the overridable method where a context selects its provider and connection string when options are not injected externally
  2. B.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  3. C.the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
  4. D.the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
Reveal the answer + AI explanation — free account

14. Which term means: "the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows"?

Mid
  1. A.unit of work
  2. B.SaveChangesAsync
  3. C.DbContext
  4. D.OnConfiguring
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.SaveChangesAsync — a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  2. B.SaveChangesAsync — the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
  3. C.SaveChangesAsync — the method that detects pending changes on tracked entities and writes them to the database within a single transaction
  4. D.SaveChangesAsync — the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
Reveal the answer + AI explanation — free account

16. What is OnConfiguring?

Mid
  1. A.the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  2. B.the overridable method where a context selects its provider and connection string when options are not injected externally
  3. C.the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
  4. D.a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.OnConfiguring — the method that detects pending changes on tracked entities and writes them to the database within a single transaction
  2. B.OnConfiguring — the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  3. C.OnConfiguring — the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  4. D.OnConfiguring — the overridable method where a context selects its provider and connection string when options are not injected externally
Reveal the answer + AI explanation — free account

19. What is DbContextOptions?

Senior
  1. A.the awaitable variant that persists pending changes without blocking the calling thread, returning the count of affected rows
  2. B.a property exposing a collection of a given entity type, used as the queryable and insertable root for that table
  3. C.the overridable method where a context selects its provider and connection string when options are not injected externally
  4. D.the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
Reveal the answer + AI explanation — free account

20. Which term means: "the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance"?

Senior
  1. A.unit of work
  2. B.DbContext
  3. C.OnConfiguring
  4. D.DbContextOptions
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Senior
  1. A.DbContextOptions — the pattern by which the context batches all tracked inserts, updates, and deletes and commits them together as one logical operation
  2. B.DbContextOptions — the overridable method where a context selects its provider and connection string when options are not injected externally
  3. C.DbContextOptions — the primary class representing a session with the database, exposing entity collections and tracking changes to objects
  4. D.DbContextOptions — the configuration object, usually built via a builder and injected through the constructor, that supplies provider and behavior settings to a context instance
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice DbContext & Sets free