0% found this document useful (0 votes)
6 views6 pages

Question

Important questions of interview

Uploaded by

Prashant Solanki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Question

Important questions of interview

Uploaded by

Prashant Solanki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Question:8

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:

A) Override OnConfiguring with the API model binder


B) Override OnModelCreating with the API model builder
C) Override OnModelCreated with the API model builder
D) All of the above

Correct Answer:

B) Override OnModelCreating with the API model builder


Question:11

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

What are the possible components involved in Dependency Injection?

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:

1.var position = 0; var nextPage = context.Posts.OrderBy(b =>


b.PostId).Skip(position).Take(10).ToList();
2.var position = 5; var nextPage = context.Posts.OrderBy(b =>
b.PostId).Skip(position).Take(10).ToList();
3.var position = 20; var nextPage = context.Posts.OrderBy(b =>
b.PostId).Skip(position).Take(10).ToList();
4. var position = 10; var nextPage = context.Posts.OrderBy(b =>
b.PostId).Skip(position).Take(10).ToList();

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:

Helps in designing tightly coupled classes


IOC principle helps in designing loosely coupled classes
COC principle helps in designing model
All of the above
Correct Option:
2. IOC principle helps in designing loosely coupled classes
Question:17

What is the purpose of the Use extension method in ASP.NET Core?

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:

Index[nameof(UserID), IsUnique true, Name="Ind_User_UserID"]


Index[nameof(User), IsUnique true, Name="Ind_User_UserID"]
Index[nameof/User/UserID), IsUnique true, Name="Ind_User_UserID"]
Index[nameof(User.UserID), IsUnique true, Name="Ind_User_UserID"]
Correct Option:
4. Index[nameof(User.UserID), IsUnique true, Name="Ind_User_UserID"]

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:

ModelBuilder.Entity.Property(x => x.State).NotEmpty(True);


ModelBuilder.Entity.Property(x => x.State).Required(True);
ModelBuilder.Entity.Property(x => x.State).IsRequired(True);
None of the above
Correct Option:
3. ModelBuilder.Entity.Property(x => x.State).IsRequired(true);

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:

ModelBuilder.Entity().Property(x => x.UKey).asDefaultValue(NEWID());


ModelBuilder.Entity().Property(x => x.UKey).HasDefaultColumn(NEWID());
ModelBuilder.Entity().Property(x => x.UKey).HasDefaultValueSql("NEWID()");
None of the above
Correct Option:
3. ModelBuilder.Entity().Property(x => x.UKey).HasDefaultValueSql("NEWID()");

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]

You might also like