Friday 18 September 2015

C#.Net Questions and Answers for Job Interviews

131. How do you debug an ASP.NET Web application? 
Attach the aspnet_wp.exe process to the DbgClr debugger.

132. How do you mark a method obsolete? 
Assuming you've done a "using System;": [Obsolete]
public int Foo() {...}
or [Obsolete("This is a message describing why this method is obsolete")]
public int Foo() {...}
Note: The O in Obsolete is capitalized.

133. How is the DLL Hell problem solved in .NET? 
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly

134. What are the ways to deploy an assembly? 
An MSI installer, a CAB archive, and XCOPY command.

135. Why does DllImport not work for me?
All methods marked with the DllImport attribute must be marked as public static extern.

136. What is a delegate? 
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

137. What is the difference between an interface and abstract class? 
In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

138. What is an abstract class? 
A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it is a blueprint for a class without any implementation.
_break

139. Does C# support multiple-inheritance? 
No.

140. Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).

More Questions & Answers:-

No comments:

Post a Comment