Dot Net Core Interview Questions and Answers
1. What is .NET Core, and what are its advantages?
.NET Core is a cross-platform, open-source, and modular framework used to build modern web applications and services. Its advantages include improved performance, higher security, and increased scalability.
2. What is the difference between .NET Core and .NET Framework?
.NET Core is a cross-platform framework used to build web applications, whereas .NET Framework is a Windows-only framework that's used to build desktop and web applications.
or
.NET Core is cross-platform, whereas .NET Framework only runs on Windows. .NET Core is also open-source, whereas .NET Framework is proprietary. .NET Core is designed to be modular, so you can use only the parts you need, whereas .NET Framework is a monolithic framework. Finally, .NET Core is designed to be used with containerization and microservices, whereas .NET Framework is not.
3. What are the main components of .NET Core?
The main components of .NET Core include the Common Language Runtime (CLR), the Base Class Library (BCL), and the .NET Core SDK.
4. What is the CLR, and what is its role in .NET Core?
The CLR is the execution engine of .NET Core. It provides the runtime environment where your code runs, manages memory allocation and garbage collection, and handles exceptions.
5. What is the BCL, and what does it contain?
The BCL is a collection of reusable classes, interfaces, and types that are used to build .NET Core applications. It contains types for collections, IO, threading, and more.
6. What is the .NET Core SDK, and what does it include?
The .NET Core SDK is a set of tools used to build and deploy .NET Core applications. It includes the CLI, the runtime, and libraries.
7. What is ASP.NET Core, and how does it differ from ASP.NET?
ASP.NET Core is a cross-platform framework used to build web applications and services. It's a redesigned version of ASP.NET that's optimized for performance and scalability and supports cross-platform development.
8. What is middleware in ASP.NET Core?
Middleware is a component that handles requests and responses in an ASP.NET Core application. They can perform tasks such as authentication, routing, and caching.
9. What is dependency injection, and how does it work in .NET Core?
Dependency injection is a design pattern used to manage dependencies between objects in an application. In .NET Core, it's implemented using the built-in DI container, which manages the creation and lifetime of objects and their dependencies.
10. What is Entity Framework Core, and how does it differ from Entity Framework?
Entity Framework Core is a lightweight, cross-platform version of Entity Framework that's optimized for performance and supports cross-platform development. It provides an object-relational mapping (ORM) framework for accessing data in a database.
11. What are the benefits of using Entity Framework Core?
The benefits of using Entity Framework Core include reduced boilerplate code, improved developer productivity, improved performance, and better security.
12. What is a migration in Entity Framework Core?
Migration is a way to update the schema of a database to match the changes made to the data model. It's implemented using the EF Core command-line interface (CLI) and generates SQL scripts to apply the changes.
13. What is the difference between LINQ and SQL?
LINQ is a language-integrated query language used to query data in .NET applications. SQL is a query language used to query data in relational databases. LINQ provides a more natural and expressive way to query data than SQL.
14. What is a lambda expression, and how is it used in .NET Core?
A lambda expression is a concise way to define an anonymous function in .NET Core. It's used extensively in LINQ queries and can also be used as a parameter to a method.
15. What is the difference between an abstract class and an interface in .NET Core?
An abstract class is a class that cannot be instantiated and can contain both abstract and non-abstract methods. An interface is a contract that defines the methods and properties that a class must implement. A class can inherit from only one abstract class but can
16. What is the purpose of the StringBuilder class in C#?
The StringBuilder class is used to efficiently manipulate strings. Unlike the string class, which is immutable, StringBuilder allows you to modify a string in place without creating a new object each time.
17. What is the difference between synchronous and asynchronous programming in .NET Core?
Synchronous programming blocks the current thread until a task is completed, whereas asynchronous programming allows the current thread to continue executing while the task is completed on a separate thread. Asynchronous programming can improve performance by allowing the application to make more efficient use of system resources.