C#.Net Interview Question and Answers

56. What are sealed classes in C#?
  The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class.
 
Your Name Your Email-ID
Your Answer
57. What is the difference between static and instance methods?
  A method declared with a static modifier is a static method. A static method does not operate on a specific instance and can only access static members.

A method declared without a static modifier is an instance method. An instance method operates on a specific instance and can access both static and instance members. The instance on which an instance method was invoked can be explicitly accessed as this. It is an error to refer to this in a static method.
 
Upendra kumar, said July 03,2011
Static method can not call by instance of a class and this key word it can use both static and instance variable.
Your Name Your Email-ID
Your Answer
58. What are the different types of variables in C#?
 
    Different types of variables used in C# are :
  • static variables
  • instance variable
  • value parameters
  • reference parameters
  • array elements
  • output parameters
  • local variables
 
Your Name Your Email-ID
Your Answer
59. What is meant by method overloading?
  Method overloading permits multiple methods in the same class to have the same name as long as they have unique signatures. When compiling an invocation of an overloaded method, the compiler uses overload resolution to determine the specific method to invoke
 
Vinayak Temgire, says Feb 01, 2014
The process of creating more than one method in a class with same name or creating a method in derived class with same name as a method in base class is called as method overloading. While overloading methods, a rule to follow is the overloaded methods must differ either in number of arguments they take or the data type of at least one argument.
Your Name Your Email-ID
Your Answer
60. What is parameters?
  Parameters are used to pass values or variable references to methods. The parameters of a method get their actual values from the arguments that are specified when the method is invoked. There are four kinds of parameters: value parameters, reference parameters, output parameters, and parameter arrays.
 
Your Name Your Email-ID
Your Answer