DbContext & Sets interview questions

21 DbContext & Sets questions from the EF Core bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

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

Answer + AI explanation with Pro

2. Which term means: "the primary class representing a session with the database, exposing entity collections and tracking changes to objects"?

Junior
  1. A.DbContextOptions
  2. B.DbSet<T>
  3. C.DbContext
  4. D.unit of work

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

5. Which term means: "a property exposing a collection of a given entity type, used as the queryable and insertable root for that table"?

Junior
  1. A.DbContextOptions
  2. B.SaveChangesAsync
  3. C.DbSet<T>
  4. D.SaveChanges

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

11. Which term means: "the method that detects pending changes on tracked entities and writes them to the database within a single transaction"?

Junior
  1. A.unit of work
  2. B.SaveChanges
  3. C.DbContext
  4. D.OnConfiguring

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

17. Which term means: "the overridable method where a context selects its provider and connection string when options are not injected externally"?

Mid
  1. A.DbContext
  2. B.OnConfiguring
  3. C.DbContextOptions
  4. D.SaveChanges

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every DbContext & Sets question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers