20 most asked latest Asp.net Core Interview Questions on November 2020

Prem Murmu on 11/21/2020 9:10:26 AM

I am Prem Murmu,I was trying to crack .net core interview questions.Here some questions i was mostly asked  in interviews. As always i was well prepared but sometime, i got stuck into some basic questions.

So you can just go through them before attending interview..

Become AWS Expert

1. What is .Net 5 ?

Ans. .NET 5.0 is the next major release of .NET Core 3.1. It is officially released on November 10, 2020.

.Net 5 is unified plaftform of the .Net Framework, .Net Core, Mono, and Xamarin to provide APIs, libraries, and run-time to create apps for Web, Windows, Mobile & IoT devices. The main goal of .Net 5 is to empower unified .Net Client Application projects to create deliverables for various platforms including Windows, UNIX, Linux, Legacy Windows, iOS, Driod, HTML5, and Macintosh.

2.What are the best of .Net core functionalities in .Net 5?


1.Cross-platform implementation with any device

2.Supports all key platform features for .Net core, Xamarin, .Net Framework

3.Open Source & Community-Oriented

4.Fast, Scalable, and high performance

5.Support with future updates to Visual Studio Code, Visual Studio 2019, Command Line 6.Interface and Visual Studio for Mac.

7.Support for platform-specific features like Windows Forms, & WPF on Windows

8.Side-by-side installation

9.Smarter Deployment & packages

10.Small Project Files

New .net core functionalities which .net 5 promises more choice on runtime experiences.

1.Java interoperability will be available on all platforms.

2.Objective-C and Swift interoperability will be supported on multiple operating systems.

3.CoreFX will be extended to support static compilation of .NET (ahead-of-time – AOT), smaller footprints and support for more operating systems.

3.What is blazor in .net core?


Blazor is an open source and cross-platform web UI framework for building interactive web UIs using C# instead of JavaScript.Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS that run on directly in the browser, using WebAssembly.

it's real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application.

4.What is .net core?

Ans..NET Core is a newer version of .NET, which is cross-platform, supporting Windows, MacOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.

The following characteristics best define .NET Core:

Flexible deployment: Can be included in your app or installed side-by-side user or machine-wide.

Cross-platform: Runs on Windows, MacOS and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided by Microsoft, other companies, and individuals.

Command-line tools: All product scenarios can be exercised at the command-line.

Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.

5.What is CTS? 

Ans:The Common Type System (CTS) standardizes the data types of all programming languages using .NET under the umbrella of .NET to a common data type for easy and smooth communication among these .NET languages.

CTS is designed as a singly rooted object hierarchy with System.Object as the base type from which all other types are derived.

CTS supports two different kinds of types:

Value Types: Contain the values that need to be stored directly on the stack or allocated inline in a structure. They can be built-in (standard primitive types), user-defined (defined in source code) or enumerations (sets of enumerated values that are represented by labels but stored as a numeric type).

Reference Types: Store a reference to the value‘s memory address and are allocated on the heap. Reference types can be any of the pointer types, interface types or self-describing types (arrays and class types such as user-defined classes, boxed value types and delegates).

6.What is the difference between .NET Core and Mono?

Ans: Mono is third party implementation of .Net Framework for Linux/Android/iOs

 .Net Core is Microsoft's own implementation for same.

7.What's the difference between SDK and Runtime in .NET Core?

Ans: The SDK is all of the stuff that is needed/makes developing a .NET Core application easier, such as the CLI and a compiler.

The runtime is the "virtual machine" that hosts/runs the application and abstracts all the interaction with the base operating system.

8.Explain the difference between Task and Thread in .NET?

Ans: Thread represents an actual OS-level thread, with its own stack and kernel resources. Thread allows the highest degree of control; you can Abort() or Suspend() or Resume() a thread, you can observe its state, and you can set thread-level properties like the stack size, apartment state, or culture. ThreadPool is a wrapper around a pool of threads maintained by the CLR.

The Task class from the Task Parallel Library offers the best of both worlds. Like the ThreadPool, a task does not create its own OS thread. Instead, tasks are executed by a TaskScheduler; the default scheduler simply runs on the ThreadPool. Unlike the ThreadPool, Task also allows you to find out when it finishes, and (via the generic Task) to return a result.

9.What are the benefits of explicit compilation?

Ans: Ahead of time (AOT) delivers faster start-up time, especially in large applications where much code executes on startup. But it requires more disk space and more memory/virtual address space to keep both the IL and precompiled images. In this case the JIT Compiler has to do a lot of disk I/O actions, which are quite expensive.

10.What is CoreCLR?

Ans: CoreCLR is the .NET execution engine in .NET Core, performing functions such as garbage collection and compilation to machine code.

11.What is JIT compiler?

Ans: Before a computer can execute the source code, special programs called compilers must rewrite it into machine instructions, also known as object code. This process (commonly referred to simply as “compilation”) can be done explicitly or implicitly.

Implicit compilation is a two-step process:

The first step is converting the source code to intermediate language (IL) by a language-specific compiler.

The second step is converting the IL to machine instructions. The main difference with the explicit compilers is that only executed fragments of IL code are compiled into machine instructions, at runtime. The .NET framework

 calls this compiler the JIT (Just-In-Time) compiler.

12.What is Kestrel?

Ans: Kestrel is a cross-platform web server built for ASP.NET Core based on libuv – a cross-platform asynchronous I/O library.

It is a default web server pick since it is used in all ASP.NET Core templates.

It is really fast.

It is secure and good enough to use it without a reverse proxy server. However, it is still recommended that you use IIS, Nginx or Apache or something else.

13.Can ASP.NET Core application work with full .NET 4.x Framework?

Ans: Yes. ASP.NET core application works with full .NET framework via the .NET standard library.

14. What is the startup class in ASP.NET core?

Ans: Startup class is the entry point of the ASP.NET Core application. Every .NET Core application must have this class. This class contains the application configuration rated items. It is not necessary that class name must "Startup", it can be anything, we can configure startup class in Program class.

public class Program {

public static void Main(string[] args)




 public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>




15. What is the use of ConfigureServices method of startup class?

Ans: This is an optional method of startup class. It can be used to configure the services that are used by the application. This method calls first when the application is requested for the first time. Using this method, we can add the services to the DI container, so services are available as a dependency in controller constructor.

16.What is the use of the Configure method of startup class?

Ans: It defines how the application will respond to each HTTP request. We can configure the request pipeline by configuring the middleware. It accepts IApplicationBuilder as a parameter and also it has two optional parameters: IHostingEnvironment and ILoggerFactory. Using this method, we can configure built-in middleware such as routing, authentication, session, etc. as well as third-party middleware.

17.What is middleware?

Ans: It is software which is injected into the application pipeline to handle request and responses. They are just like chained to each other and form as a pipeline. The incoming requests are passes through this pipeline where all middleware is configured, and middleware can perform some action on the request before passes it to the next middleware. Same as for the responses, they are also passing through the middleware but in reverse order.

18.What is the difference between IApplicationBuilder.Use() and IApplicationBuilder.Run()?

Ans: We can use both the methods in Configure methods of startup class. Both are used to add middleware delegate to the application request pipeline. The middleware adds using IApplicationBuilder.Use may call the next middleware in the pipeline whereas the middleware adds using IApplicationBuilder.Run method never calls the subsequent ore next middleware. After IApplicationBuilder.Run method, system stop adding middleware in request pipeline.

19.What is the use of "Map" extension while adding middleware to ASP.NET Core pipeline?

Ans: It is used for branching the pipeline. It branches the ASP.NET Core pipeline based on request path matching. If request path starts with the given path, middleware on to that branch will execute.

 public void Configure(IApplicationBuilder app)


 app.Map("/path1", Middleware1);

 app.Map("/path2", Middleware2);


20. What is routing in ASP.NET Core?

Ans: Routing is functionality that map incoming request to the route handler. The route can have values (extract them from URL) that used to process the request. Using the route, routing can find route handler based on URL. All the routes are registered when the application is started. There are two types of routing supported by ASP.NET Core

1.The conventional routing

2.Attribute routing

The Routing uses routes for map incoming request with route handler and Generate URL that used in response. Mostly, the application having a single collection of routes and this collection are used for the process the request. The RouteAsync method is used to map incoming request (that match the URL) with available in route collection.

Bonus :  Best 7 interview .net core questions Below

21. How to enable Session in ASP.NET Core?

Ans: The middleware for the session is provided by the package Microsoft.AspNetCore.Session. To use the session in ASP.NET Core application, we need to add this package to csproj file and add the Session middleware to ASP.NET Core request pipeline.

 public class Startup


 public void ConfigureServices(IServiceCollection services)







 public void Configure(IApplicationBuilder app, IHostingEnvironment env)









22.What are the various JSON files available in ASP.NET Core?

Ans: There are following JSON files in ASP.NET Core :







23.What is tag helper in ASP.NET Core?

Ans: It is a feature provided by Razor view engine that enables us to write server-side code to create and render the HTML element in view (Razor). The tag-helper is C# classes that used to generate the view by adding the HTML element. The functionality of tag helper is very similar to HTML helper of ASP.NET MVC.


 //HTML Helper

 @Html.TextBoxFor(model => model.FirstName, new { @class = "form-control", placeholder = "Enter Your First Name" }) 

 //content with tag helper

 <input asp-for="FirstName" placeholder="Enter Your First Name" class="form-control" /> 

 //Equivalent HTML

 <input placeholder="Enter Your First Name" class="form-control" id="FirstName" name="FirstName" value="" type="text"> 

24.How to disable Tag Helper at element level?

Ans: We can disable Tag Helper at element level using the opt-out character ("!"). This character must apply opening and closing the Html tag.


 <!span asp-validation-for="phone" class="divPhone"></!span>

25.What are Razor Pages in ASP.NET Core?

Ans: This is a new feature introduced in ASP.NET Core 2.0. It follows a page-centric development model just like ASP.NET web forms. It supports all the feature of ASP.NET Core.



 <h1> Hello, Book Reader!</h1> 

 <h2> This is Razor Pages </h2>

The Razor pages start with the @page directive. This directive handle request directly without passing through the controller. The Razor pages may have code behind file, but it is not really code-behind file. It is class inherited from PageModel class.

26. How can we do automatic model binding in Razor pages?

 Ans: The Razor pages provide the option to bind property automatically when posted the data using BindProperty attribute. By default, it only binds the properties only with non-GET verbs. we need to set SupportsGet property to true to bind a property on getting request.


 public class Test1Model : PageModel



 public string Name { get; set; }


27. How can we inject the service dependency into the controller?

Ans: There are three easy steps to add custom service as a dependency on the controller.

Step 1: Create the service

 public interface IHelloWorldService


 string SaysHello();



 public class HelloWorldService: IHelloWorldService


 public string SaysHello()


 return "Hello ";



Step 2: Add this service to Service container (service can either added by singleton, transient or scoped)

public void ConfigureServices(IServiceCollection services)




 services.AddTransient<IHelloWorldService, HelloWorldService>();




Step 3: Use this service as a dependency in the controller

 public class HomeController: Controller


 IHelloWorldService _helloWorldService;

 public HomeController(IHelloWorldService helloWorldService)


 _helloWorldService = helloWorldService;



Azure AI 100 Training Course

=>>>> Best Of Luck <<<<=

Aslo watch..

Tips and tricks to crack az 204

0 Comments on this post

Comments(0)||Login to Comments

InterServer Web Hosting and VPS
  • see more..