- .NET interview questions with explanations
What is .NET Framework?
The .NET Framework is a software development framework developed by Microsoft.
It provides a programming model, libraries, and runtime for building and executing applications on Windows-based systems.
It supports multiple programming languages like C#, VB.NET, and F#, and
allows developers to build a wide range of applications, including
desktop applications, web applications, and mobile applications.
What is the difference between .NET Framework and .NET Core?
.NET Framework and .NET Core are two different implementations of the .NET platform.
.NET Framework is the traditional full-featured framework that runs on Windows only,
while .NET Core is a cross-platform, open-source framework that runs on Windows, macOS, and Linux.
.NET Core is also more modular and lightweight compared to the .NET Framework.
What is C#?
C# (pronounced C sharp) is a programming language developed by Microsoft.
It is a strongly-typed, object-oriented language that is used primarily for building applications on the .NET platform.
C# is similar to Java in terms of syntax and has a rich set of features
that make it a powerful language for developing a wide variety of applications.
Explain the difference between value types and reference types in C#.
In C#, value types are types that hold their data directly and are stored in the stack memory.
Examples of value types include integers (int), floating-point numbers (float), and structs.
Reference types, on the other hand, store a reference to their data in the stack memory, while the actual data is stored in the heap memory.
Examples of reference types include classes, interfaces, and delegates.
Value types are typically small in size and have a short lifespan, while reference types can be larger and have a longer lifespan.
What are the different types of collections in .NET?
- ArrayList: A dynamically resizable array.
- List<T>: A generic list that can store elements of a specific type.
- Dictionary<TKey, TValue>: A collection of key-value pairs.
- HashSet<T>: A collection of unique elements.
- Queue<T>: A first-in, first-out (FIFO) collection.
- Stack<T>: A last-in, first-out (LIFO) collection.
.NET provides several types of collections to store and manipulate data. Some of the commonly used collections are:
What is ASP.NET?
ASP.NET is a web development framework provided by Microsoft for building web applications.
It allows developers to build dynamic websites and web services using languages
like C# or VB.NET. ASP.NET provides various features like server controls, data binding,
authentication, and state management to simplify web application development.
Explain the concept of garbage collection in .NET.
Garbage collection is a process in .NET that automatically manages the memory used by an application.
It frees up memory occupied by objects that are no longer referenced by the application, ensuring efficient memory usage.
The garbage collector identifies and releases the memory of such objects, allowing
developers to focus on writing code without explicitly deallocating memory.
What are delegates in C#?
Delegates in C# are similar to function pointers in other languages.
They are used to define and encapsulate a reference to a method with a specific signature.
Delegates allow methods to be assigned to variables, passed as arguments to other methods, and invoked at a later time.
They are commonly used in event handling and callback scenarios.
What is the role of the Global Assembly Cache (GAC) in .NET?
The Global Assembly Cache (GAC) is a centralized cache provided by .NET to store
shared assemblies that can be accessed by multiple applications.
Comments
Post a Comment