2.8.08

C#.NET Interview Questions

Question - Define assembly.
Answer - An assembly is the primary unit of a .NET application. It includes an assembly manifest that describes the assembly.
Question - What is Constructor?
Answer - It is the first method that are called on instantiation of a type. It provides way to set default values for data before the object is available for use. Performs other necessary functions before the object is available for use.
Question - What is Destructor?
Answer - It is called just before an object is destroyed. It can be used to run clean-up code. You can't control when a destructor is called since object clean up by common language runtime. Question - Define Abstract class in C#.NET.
Answer - Abstract class cannot be instantiated.
Same concept in C++ known as pure virtual method.
A class that must be inherited and have the methods over-ridden.
A class without any implementation.
Question - Explain serialization?
Answer - Serialization is a process of converting an object into a stream of bytes. .Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer. Serialization is maily used in the concept of .Net Remoting.
Question - C#.Net support multiple inheritance, comment.
Answer - No, but we can use interface instead.
Question - Can private virtual methods be overridden in C#.NET?
Answer - No, moreover, you cannot access private methods in inherited classes,
They have to be protected in the base class to allow any sort of access.

No comments: