Question
Question
Which methods are used in Entity Framework Core to define relationships between entities, and
which pair correctly establishes a one-to-many relationship?
Options:
1.HasOne, HasMany
2.HasMany, WithOne
3.HasOne, WithMany
4.WithOne, WithMany
Correct Option:
2. HasMany, WithOne
Question:9
Which methods are correctly used in Entity Framework Core migrations to apply and revert changes
to the database schema?
Options:
1. Up(MigrationBuilder), Drop(MigrationBuilder)
2. Up(), Drop()
3. Up(MigrationBuilder), Down(MigrationBuilder)
4. Up(Migration), Drop(Migration)
Correct Option:
3. Up(MigrationBuilder), Down(MigrationBuilder)
Question:10
Which method in Entity Framework Core is used to configure the database context and models when
working with the API model binder and model builder?
Options:
Correct Answer:
Which design pattern is used to provide a global point of access to a shared instance of a class,
ensuring that only one instance of the class is created throughout the application lifecycle?
Options:
A) Abstract Factory
B) Singleton
C) Service Locator
D) Dependency Injection
Correct Answer:
B) Singleton
Question:12
Which statement accurately describes how ASP.NET Core handles routing and execution of HTTP
requests in the middleware pipeline?
Options:
1.When UseRouting and UseEndpoints are used in the middleware pipeline, this means that ASP.NET
Core is performing endpoint routing.
2.This is where routing is implemented, splitting the routing middleware into two separate
middleware components: routing and endpoints.
3.An endpoint is an object that contains the information needed to execute a request.
4.The endpoints middleware matches the URL and then the routing middleware executes the HTTP
request.
Correct Option:
1.When UseRouting and UseEndpoints are used in the middleware pipeline, this means that ASP.NET
Core is performing endpoint routing.
Question:13
Which method signature is correct for configuring the DbContext in Entity Framework Core?
Options:
1.OnConfiguring(DbContextOptions opt)
2.OnConfiguiring(DbContextOptionsBuilder opt)
3.OnConfigure(DbContextOptionsBuilder opt)
4.None of the above
Correct Option:
2. OnConfiguring(DbContextOptionsBuilder opt)
Question:14
Options:
A) Client, Service
B) Client, Service, Injector
C) Client, Service, Object
D) All of the above
Correct Option:
B) Client, Service, Injector
Question:15
Given the following code snippets for paginating a list of posts from a database, which var position
value will correctly retrieve the third page of posts, assuming each page contains 10 posts?
Options:
Correct Option:
3. var position = 20; var nextPage = context.Posts.OrderBy(b =>
b.PostId).Skip(position).Take(10).ToList();
Question:16
Which principle is associated with designing loosely coupled classes in software architecture?
Options:
Options:
The Use extension method in ASP.NET Core is used to add a new middleware component to the
request processing pipeline.
The Use extension in an ASP.NET Core application allows us to add a new middleware component
that may call the next middleware component in the request processing pipeline.
The Use extension method adds a middleware delegate defined inline to the application's request
pipeline. The Use method is also implemented as an extension method on the IApplicationBuilder
interface.
All of the above
Correct Option:
4. All of the above
Options:18
RuleFor(x =>
x.email).EmailAddress(FluentValidation.Validator.EmailValidationMode).WithMessage("Provide Valid
Email")
RuleFor(x =>
x.email).EmailAddress(FluentValidation.Validator.EmailValidationMode.AspNetCoreCompatible).Win
Message("Provide Valid Email")
RuleFor(x => x.email).EmailAddress(Validator.EmailValidationMode).WithMessage("Provide Valid
Email")
RuleFor(x => x.email).EmailAddress(FluentValidation.Validator).WithMessage("Provide Valid Email")
Correct Option:
1. RuleFor(x =>
x.email).EmailAddress(FluentValidation.Validator.EmailValidationMode).WithMessage("Provide Valid
Email")
Question:19
Which of the following tasks are typically involved in configuring an ASP.NET Core application?
Options:
Configure logging to read from the Logging section of the appsettings.json file and log to the Console
and Debug window.
Configure integration with IIS.
Configure the default service provider.
All of the above
Correct Option:
4. All of the above
Question:20
Which of the following options correctly defines a unique index on the UserID column for the User
entity in Entity Framework Core?
Options:
Question:21
Which of the following options correctly configures the State property of an entity to be required in
Entity Framework Core using the Fluent API?
Options:
Question:23
Which of the following options correctly sets a default value for the UKey property to a new GUID
using Entity Framework Core’s Fluent API?
Options:
Question:24
Which attribute is used to specify that a property in an Entity Framework Core model should not be
mapped to a database column?
Options:
[NotMapped]
[NotRequired]
[NoKey]
None of the above
Correct Option:
[NotMapped]