C#.Net Interview Question and Answers

121. What is the difference between an abstract method & virtual method?
  An Abstract method does not provide an implementation and forces overriding to the deriving class (unless the deriving class also an abstract class), where as the virtual method has an implementation and leaves an option to override it in the deriving class. Thus Virtual method has an implementation & provides the derived class with the option of overriding it. Abstract method does not provide an implementation & forces the derived class to override the method.
 
Your Name Your Email-ID
Your Answer
122. What is Static Method?
  It is possible to declare a method as Static provided that they don't attempt to access any instance data or other instance methods.
 
Your Name Your Email-ID
Your Answer
123. What is a New modifier?
  The new modifier hides a member of the base class. C# supports only hide by signature.
 
Your Name Your Email-ID
Your Answer
124. What are the advantages of get and set properties in C#?
 
  • The get property accessor is used to return the property value.
  • The set property accessor is used to assign a new value.
 
Your Name Your Email-ID
Your Answer
125. What are the difference between const and readonly?
 
  • A const can not be static, while readonly can be static.
  • A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.
  • A const's value is evaluated at design time, while a readonly's value is evaluated at runtime.
 
Your Name Your Email-ID
Your Answer