C#/.NET interview questions:
What is C# and what is it used for?
C# is a high-level, object-oriented programming language that is used to develop applications for the .NET Framework. It was developed by Microsoft and is used for a wide range of applications, including desktop applications, web applications, and games.
What is the difference between value types and reference types in C#?
Value types store their data directly in memory, while reference types store a reference to the data in memory. Value types include simple types such as int and float, while reference types include objects and arrays.
What is a constructor in C#?
A constructor is a special method in a class that is called when an instance of the class is created. It is used to initialize the object and its properties.
What is the difference between an abstract class and an interface in C#?
An abstract class can contain both concrete and abstract methods, while an interface only contains abstract methods. A class can inherit from only one abstract class, but can implement multiple interfaces.
What is the difference between a delegate and an event in C#?
A delegate is a type that represents a reference to a method. An event is a mechanism for notifying other parts of the code when something happens, and it uses delegates to handle the notifications.
What is LINQ in C#?
LINQ (Language Integrated Query) is a feature in C# that provides a way to query data from various data sources, such as arrays, collections, and databases.
What is the difference between a struct and a class in C#?
A struct is a value type that is typically used to represent simple data types, such as numbers or coordinates. A class is a reference type that can contain properties, methods, and events.
What is the .NET Framework and what is it used for?
The .NET Framework is a software framework developed by Microsoft that is used to build and run applications on Windows. It provides a common set of tools and libraries for developing applications, including a runtime environment, a class library, and a set of development tools.
What is the difference between the stack and the heap in C#?
The stack is used to store value types and method calls, while the heap is used to store reference types and objects. Value types are stored directly on the stack, while reference types are stored on the heap and are accessed through a reference.
What is serialization in C#?
Serialization is the process of converting an object into a format that can be stored or transmitted, such as XML or JSON. Deserialization is the process of converting the serialized data back into an object.