Never Miss a Post. Subscribe Now!

Contact Us: nawabblog@gmail.com

Location : Bangalore India.

© 2019 proudly created  by Nawab Ahmad. 

  • Nawab Ahmad
  • Grey Twitter Icon
  • Nawab Ahmad

ASP.NET Core Interview Questions -2020









ASP.NET Core is not an ASP.NET update. ASP.NET Core rewrites this work entirely with the.net Core platform. It supports a lot faster, more configurable, more modular, more flexible, more extensible and cross-platform. To prepare you for the interview, this article contains the top 20 ASP.NET Core interview questions and answers.


What is the ASP.NET Core?


ASP.NET Core is not an ASP.NET update. ASP.NET Core rewrites this work entirely with the.net Core platform. It supports a lot faster, more configurable, more modular, more flexible, more extensible and cross-platform. Using the .NET core framework, it can work with both .NET Core and.net framework. It is best suited for creating cloud-based applications such as web apps, mobile apps, IoT apps.


.NET Core best defines the following characteristics:


  • Flexible deployment: can be included in your application or installed side-by-side user or machine-wide.

  • Cross-platform: runs on Windows, MacOS and Linux; it can be transferred to other operating systems. Operating Systems (OS), CPUs and software scenarios sponsored by Microsoft, other organizations, and individuals can grow over time.

  • Command-line tools: You can test all consumer scenarios on the command-line.

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


What are the features that ASP.NET Core provides?


The core features offered by the ASP.NET Core:

  • Built-in supports for Dependency Injection

  • Built-in supports for the logging framework and it can be extensible

  • Introduced new, fast and cross-platform web server-Kestrel can be implemented and expanded. So, without IIS, Apache, and Nginx, a web application can run.

  • This supports modularity, so the designer must include the application's appropriate component. .NET Core architecture, however, also provides the meta package that includes libraries.

  • Command line supports the application to be created, created and run.

  • There's no directory for web.config. The custom configuration can be saved in an appsettings.json folder.

  • There's no file for Global.asax. Now we can register and use the services in the start-up class.

  • It has good support for programming asynchronously

  • WebSocket and SignalR support

  • Provide CSRF protection (Cross-Site Forgery Request)


What are ASP.NET Core's strengths over ASP.NET?


  • It's cross-platform, so Windows, Linux, and Mac can run it.

  • There is no dependence on framework installation as all the required dependencies are shipped with our ASP.NET Core application that can handle more requests than the ASP.NET

  • Multiple deployment options available with ASP.NET Core.


What is the difference between SDK and Runtime in .NET Core?


The SDK is all the stuff needed / makes it easier to build a .NET Core code, like the CLI and a compiler. The runtime is the "virtual machine" that hosts / runs the program and abstracts all the base operating system interaction.


What is the difference between the.NET Core framework and the .NET framework?


.NET as a whole now has two flavours:

  • .NET Framework.

  • .NET Core

.NET Core and the .NET Framework (mostly) have a subset-superset relationship. .NET Core is called "Core" as it includes the core features for both runtime and application libraries from the. NET Application. For example,.NET Core and the. NET Framework share the GC, the JIT, and types like String and List.

.NET Core was designed to enable .NET to be open source, cross platform and use in more resource-constrained environments.


What is Kestrel?


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

  • It is a web server pick by default as it is used in all ASP.NET Core Templates.

  • It really is quick.

  • Without a reverse proxy server it is safe and good enough to use it.

  • It's still recommended to use IIS, Nginx or Apache or something else, however.


What is WebListener?


ASP.NET Core ships Kestral and WebListener, two server implementations. WebListener is also an ASP.NET Core web server which only runs on Windows. It's built on the kernel mode driver for the Hľ. Sys kernel. WebListener is an alternative to Kestrel, which can be used without relying on IIS as a reverse proxy server for direct connection to the Internet.

Explain what the.NET Core includes?


  • A.NET runtime providing a system type, assembly loading, garbage collector, interop native, and other basic services.

  • A collection of application libraries, including primitive data types, types of device structure, and basic utilities.

  • A collection of SDK tools and language compilers, available in the. NET Core SDK, that allow the base developer experience.

  • The' dotnet' app server, used to launch the. NET Core applications. It selects runtime, host runtime, offers a policy for assembly setup, and launches the program. They also use the same host to enable SDK software in much the same way.

Explain the difference between Task and Thread in .NET?


  • Thread represents an actual thread at the OS level, with its own resources for stack and kernel. Thread allows the highest degree of control; you can set a thread to Abort()or Suspend() or Resume(), observe its state, and set thread-level properties such as stack size, apartment status, or culture. ThreadPool is a wrapper around a pool of threads which the CLR maintains.

  • The Task Parallel Library Task class offers the best of both worlds. Like the ThreadPool, a process does not build its own thread for operating systems. Instead, a TaskScheduler executes the tasks; the default scheduler runs simply on the ThreadPool. Unlike the ThreadPool, Task also enables you to find out when it's finished, and to return a result (via the generic task).


What are the benefits of explicit compilation?


Ahead of time (AOT) provides faster startup time, especially in large applications where a lot of code is executed on startup. Yet retaining both the IL and precompiled images requires more disk space and more memory / virtual address space. The JIT Compiler has a lot of disk I/O actions to do in this case which are quite expensive.


When should we use project types such as .NET Core and .NET Standard Class Library?


  • Use a .NET Standard Library to increase the number of applications that will be compatible with your library, and you're ok with a decrease in your library's .NET API surface area.

  • Use a .NET Core library when you want to increase your library's access to the .NET API surface area, and you're OK to allow only the Core apps to be compatible with your library.


What are the different ways ASP.NET Core will bundle and minify?


ASP.NET Core offers different ways to do bundling and mining.


  • Gulp –was the default ASP.NET Core option until the beta versions. It was later removed because of performance and speed problem and replaced with BundlerMinifier. Read that post to find out why this decision was made.

  • BundlerMinifier–is an extension to Visual Studio, and it is now the default choice. You should check out bundleconfig.js

  • BundlerMinifier – is a Visual Studio extension and it’s default choice now. You should see bundleconfig.json file in your default template.

  • ASP.NET Core Web Optimizer – ASP.NET Core middleware for bundling and minification of CSS and JavaScript files at runtime.

  • Grunt – can also be used with ASP.NET Core.


What's the difference between Asp. Net Core services. AddTransient and service. AddScope methods?


ASP.NET Core supports dependency injection out of the box. Those 3 methods allow the dependency to be registered. However for registered service they offer different lifespan. For each request transient objects are created (when requested). The longevity works best for stateless, lightweight programs. Scoped artifacts within a request are the same, but vary across different requests.Singleton objects created the first time they 're requested (or when ConfigureServices is run and an instance is specified with the service registration).

57 views