Search test library by skills or roles
⌘ K

Adaface Sample Entity Framework Questions

Here are some sample Entity Framework questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Medium

Global Query Filters
Global Query Filters
Soft Delete
Solve
In an Entity Framework Core project, you're working on an e-commerce application where products can be 'soft deleted'. A soft deleted product is not physically removed from the database, but is flagged as deleted and should not appear in normal query results. Assume that your Product model includes an IsDeleted boolean property.
            
            Your task is to implement a global query filter to exclude soft deleted products from all queries throughout the application.
            
            Which of the following is the correct way to implement this requirement in your DbContext derived class, ProductContext?
 image

Medium

Implicit and Explicit Loading
Loading Strategies
Relationships
Solve
In an Entity Framework Core project, you have two related entities, Product and Category. Each Product entity has a navigation property Category that represents the Category entity associated with the product.
            
            You have the following code that retrieves a product:
 image
The Product and Category entities are defined as follows:
 image
You call the GetProduct method and then access the Category.Name property of the returned Product entity. What will happen?
A: The Category.Name property will have the name of the category associated with the product.
            B: The Category.Name property will be null
            C: An NullReferenceException error will be thrown when accessing the Category.Name property.
            D: The Category.Name property will have the default value for a string

Medium

Transaction Management
Transaction Management
Solve
In an Entity Framework Core project, you are tasked with managing transactional operations within a ProductService. Assume the database context, DbContext, is injected into ProductService. You need to ensure that an operation updating the stock quantity of a product is atomic. If any error occurs during this operation, the changes must not be saved to maintain data integrity.
            
            Given the following code snippet for the UpdateStock method, which is the correct way to achieve this?
 image
 image
🧐 Question🔧 Skill

Medium

Global Query Filters
Global Query Filters
Soft Delete

2 mins

Entity Framework
Solve

Medium

Implicit and Explicit Loading
Loading Strategies
Relationships

3 mins

Entity Framework
Solve

Medium

Transaction Management
Transaction Management

2 mins

Entity Framework
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Global Query Filters
Global Query Filters
Soft Delete
Entity Framework
Medium2 mins
Solve
Implicit and Explicit Loading
Loading Strategies
Relationships
Entity Framework
Medium3 mins
Solve
Transaction Management
Transaction Management
Entity Framework
Medium2 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1500+ companies in 80+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️