0% found this document useful (0 votes)
35 views8 pages

Core Interview Ques

Uploaded by

Saad Bin Shafi
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)
35 views8 pages

Core Interview Ques

Uploaded by

Saad Bin Shafi
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/ 8

1. What is .NET Core, and how does it differ from the .NET Framework?

.NET Core is a cross-platform, open-source framework for building applications


that can run on Windows, macOS, and Linux. .NET Framework is Windows-only
and primarily used for desktop applications. .NET Core is modular and
lightweight, while .NET Framework is more monolithic.
2. Explain the key features of .NET Core.

 Cross-Platform: Runs on multiple operating systems.


 Open Source: Community-driven development.
 Modular: You can include only the necessary components.
 High Performance: Optimized for speed and efficiency.
 Built-in Dependency Injection: Simplifies managing dependencies.

3. What are the benefits of using .NET Core?

 Flexibility: Develop applications for various platforms.


 Performance: Faster and more efficient than .NET Framework.
 Modern Development Practices: Supports microservices and cloud-based
applications.
 Active Community Support: Regular updates and improvements.

4. What platforms does .NET Core support?


.NET Core supports:

 Windows
 macOS
 Linux

5. Describe the architecture of .NET Core.


.NET Core has a modular architecture consisting of:

 CoreCLR: The runtime that executes applications.


 CoreFX: A set of libraries for common tasks.
 Command-Line Interface (CLI): Tools for managing applications.

6. What are the main components of the .NET Core runtime?

 CoreCLR: Executes .NET applications.


 Garbage Collector: Manages memory automatically.
 JIT Compiler: Converts intermediate code to machine code.

7. What is ASP.NET Core, and how does it relate to .NET Core?


ASP.NET Core is a framework for building web applications and APIs on top
of .NET Core. It combines features of MVC and Web API into a single framework.
8. What is the difference between .NET Core and ASP.NET Core?

 .NET Core is a general-purpose framework for various applications.


 ASP.NET Core is specifically for web applications and APIs.

9. Explain the concept of Dependency Injection in .NET Core.


Dependency Injection (DI) is a design pattern that allows a class to receive its
dependencies from an external source rather than creating them itself. This makes
the code more flexible and easier to test.
10. How do you configure Dependency Injection in .NET Core?

1. Create an Interface: Define the contract for your service.


2. Implement the Interface: Create a class that implements the interface.
3. Register the Service: In Startup.cs, add the service to the DI container.
4. Inject the Service: Use constructor injection in your classes.

11. What is Middleware in ASP.NET Core?


Middleware is software that processes requests and responses in the application
pipeline. It can handle tasks like authentication, logging, and error handling.
12. How does Routing work in ASP.NET Core?
Routing maps incoming requests to specific endpoints (controllers or actions)
based on the URL patterns defined in the application.
13. What are Tag Helpers in ASP.NET Core?
Tag Helpers are server-side components that enable you to create HTML elements
with C# code. They make it easier to work with HTML in Razor views.
14. What is Razor Pages in ASP.NET Core?
Razor Pages is a page-based programming model that simplifies building web UI.
It allows you to organize your code around pages rather than controllers.
15. Explain the difference between ViewBag, ViewData, and TempData in
ASP.NET Core.

 ViewBag: A dynamic object for passing data from the controller to the view.
 ViewData: A dictionary for passing data to the view, but requires type casting.
 TempData: Stores data temporarily, useful for redirect scenarios.

16. What are the different types of Filters in ASP.NET Core, and how are they
used?
Filters are used to run code before or after an action method executes. Types
include:

 Authorization Filters: Check user permissions.


 Action Filters: Run code before/after an action executes.
 Result Filters: Run code before/after the result is executed.

17. What is Entity Framework Core, and how does it differ from Entity
Framework 6?
Entity Framework Core is a lightweight, cross-platform version of Entity
Framework. It supports more modern development practices and is designed
for .NET Core, while EF 6 is Windows-only.
18. Describe the Database-First, Code-First, and Model-First approaches in
Entity Framework Core.

 Database-First: Start with an existing database and generate models.


 Code-First: Define models in code and create the database from them.
 Model-First: Design models visually and generate both code and database.

19. What are Migrations in Entity Framework Core, and how are they used?
Migrations are a way to update the database schema based on changes in your
model classes. You can add, remove, or modify tables and columns.
20. How do you configure logging in ASP.NET Core?
Logging can be configured in Startup.cs using the built-in logging framework. You
can specify log levels and providers (like console, file, etc.).
21. Explain the concept of Middleware Pipeline in ASP.NET Core.
The Middleware Pipeline is a sequence of middleware components that handle
requests and responses. Each component can process the request, call the next
component, and modify the response.
22. What is the use of appsettings.json file in ASP.NET Core?
appsettings.json is used to store configuration settings for the application, such as
connection strings and application settings.
23. How do you implement Authentication and Authorization in ASP.NET
Core?
Authentication verifies user identity, while authorization checks permissions. You
can use built-in authentication schemes (like JWT, cookies) and configure policies
in Startup.cs.
24. What is JWT authentication, and how is it implemented in ASP.NET
Core?
JWT (JSON Web Token) authentication is a method for securely transmitting
information between parties. In ASP.NET Core, you can configure JWT
authentication in Startup.cs using middleware.
25. Describe the concept of Health Checks in ASP.NET Core.
Health Checks are used to monitor the status of your application and its
dependencies. You can implement health checks to ensure your application is
running smoothly.
26. How do you implement Caching in ASP.NET Core?
Caching can be implemented using in-memory caching or distributed caching. You
can configure caching in Startup.cs and use attributes to cache responses.
27. What is the purpose of the ConfigureServices and Configure methods in
Startup.cs file?

 ConfigureServices: Used to register services with the DI container.


 Configure: Defines the middleware pipeline for handling requests.

28. Explain the concept of Razor Class Libraries (RCL) in ASP.NET Core.
Razor Class Libraries allow you to create reusable UI components (like views
and pages) that can be shared across multiple applications.
29. How do you handle Errors and Exceptions in ASP.NET Core?
You can handle errors globally using middleware or by using try-catch blocks in
your code. Custom error pages can also be configured.
30. What is the role of IWebHostEnvironment in ASP.NET Core?
IWebHostEnvironment provides information about the web hosting environment,
such as whether the application is in development or production mode.
31. Describe the different types of Testing in .NET Core.
Testing types include:

 Unit Testing: Testing individual components.


 Integration Testing: Testing how components work together.
 Functional Testing: Testing the application against requirements.

32. What is the purpose of NuGet in .NET Core development?


NuGet is a package manager for .NET that allows developers to easily install,
update, and manage libraries and tools in their projects.
33. How do you create and publish NuGet packages?
You can create a NuGet package by defining a .nuspec file and using the dotnet
pack command. Publishing can be done using dotnet nuget push.
34. What is Docker, and how is it used in .NET Core development?
Docker is a platform for developing, shipping, and running applications in
containers. In .NET Core, you can containerize applications for easier deployment
and scaling.
35. Describe the process of Containerizing ASP.NET Core applications.
To containerize an ASP.NET Core application, you create a Dockerfile that defines
how to build the image, then use Docker commands to build and run the container.
36. How do you implement Health Checks in Docker containers?
You can implement health checks in Docker by defining
a HEALTHCHECK instruction in your Dockerfile that specifies how to check the
container’s health.
37. What are the advantages of using Docker Compose in .NET Core
development?
Docker Compose allows you to define and run multi-container applications easily.
It simplifies managing dependencies and configurations for complex applications.
38. Explain the concept of Microservices architecture, and how is it
implemented in .NET Core?
Microservices architecture involves building applications as a collection of
small, independent services. In .NET Core, you can create microservices using
ASP.NET Core and deploy them in containers.
39. How do you handle Configuration Management in .NET Core
applications?
Configuration management can be handled using appsettings.json, environment
variables, and command-line arguments. You can access configurations using the
built-in configuration system.

It looks like my response got cut off! Here’s a continuation of the answers to your
questions about .NET Core:

40. What is the role of HttpClientFactory in .NET Core?

HttpClientFactory is used to create and manage HttpClient instances. It helps to


avoid issues like socket exhaustion by reusing HttpClient instances and provides a
central place to configure them.

41. Describe the concept of Background Services in .NET Core.

Background Services are long-running tasks that run in the background of an


application. They are useful for tasks like processing queues or scheduled jobs.

42. How do you implement Background Tasks in ASP.NET Core?

You can implement background tasks by creating a class that inherits from
BackgroundService and overriding the ExecuteAsync method to define the task.

43. What is the purpose of Worker Services in .NET Core?

Worker Services are designed for running background tasks in a hosted service.
They are ideal for applications that need to perform background processing without
a web interface.

44. Explain the concept of Hosting Environment in ASP.NET Core.


The Hosting Environment defines the environment in which the application is
running (e.g., Development, Staging, Production). It affects configuration and
logging.

45. How do you implement Health Checks for Azure App Services?

You can implement health checks in Azure App Services by configuring the health
check endpoint in the Azure portal and ensuring your application responds
correctly to health check requests.

46. Describe the process of Continuous Integration and Continuous


Deployment (CI/CD) for .NET Core applications.

CI/CD involves automating the process of testing and deploying applications. You
can use tools like Azure DevOps or GitHub Actions to set up pipelines that build,
test, and deploy your .NET Core applications.

47. What is the purpose of Middleware Analysis in ASP.NET Core?

Middleware Analysis helps you understand the order and behavior of middleware
components in the pipeline. It’s useful for debugging and optimizing request
processing.

48. How do you handle Internationalization and Localization in ASP.NET


Core?

You can handle internationalization and localization by using resource files to store
translations and configuring the application to use the appropriate culture based on
user preferences.

49. What are the different Deployment options for .NET Core applications?

Deployment options include:

 Self-Contained Deployment: Includes the .NET runtime with the


application.
 Framework-Dependent Deployment: Requires the .NET runtime to be
installed on the host.
 Docker Containers: Package the application in a container for easy
deployment.
50. How do you troubleshoot performance issues in .NET Core applications?

You can troubleshoot performance issues by using profiling tools, analyzing logs,
and monitoring application metrics. Look for bottlenecks in database queries,
memory usage, and response times.

You might also like