OOPs Interview Question and Answers
31. |
What are the three ways to perform string comparison in C#? |
|
In C#, there are three ways to perform the string comparison.- Using Compare () method.
- Using Equals () method.
- Using = = operator.
|
|
|
32. |
What is the difference between field and methods? |
|
- Fields - Variables declared in the class to hold data.
- Methods- Function members defined in the class. Used to implement the computations and actions to be performed.
|
|
|
33. |
What is the use of base keyword? |
|
- A subclass constructor is used to construct the instance variables of both the derived class and the base class.
- The subclass constructor uses the keyword base to invoke the constructor method of the super class.
|
|
|
34. |
Define Mutable string? |
|
A destructor is a mechanism to release the resources when an object is reclaimed by the garbage collector.
The name of the destructor is the same as the class name and is preceded by a tilde (~).
|
|
|
35. |
Define Immutable String? |
|
- Characters contained in the strings are not modified.
- Created using system.string class.
|
|
|
123456789101112
Page 7 of 12