C#.NET INTERVIEW QUESTION & ANSWERS
91. |
Are all methods virtual in C#? |
|
No. Like C++, methods are non-virtual by default, but can be marked as virtual.
|
92. |
What is a basic difference between the while loop and do while loop in C#? |
|
The while looptests its condition at the beginning, which means that the enclosed set of statements run for zero or more number of times if the condition evaluates to true. The do while loop iterates a set of statements at least once and then checks the condition at the end.
|
93. |
What is the difference between Shadowing and Overriding? |
|
- Overriding redefines only the implementation
- While shadowing redefines the whole element.
- In Overriding derived classes can refer the parent class element by using "ME" keyword
- but in shadowing you can access it by "MYBASE"
.
|
94. |
Where are all .NET Collection classes located? |
|
System.Collection namespace has all the collection classes available in .NET. |
95. |
What types of object can I throw as exceptions? |
|
Only instances of the System.Exception classes, or classes derived from System.Exception. This is in sharp contrast with C++ where instances of almost any type can be thrown. |