Pages

Friday, 18 September 2015

Page11 C#.Net Interview Questions and Answers

111. Can you store multiple data types in System.Array? 
No.

112. What’s the top .NET class that everything is derived from? 
System.Object.

113. What does the term immutable mean? 
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

114. What’s the difference between System.String and System.Text.StringBuilder classes? 
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

115. What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

116. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? 
The first one performs a deep copy of the array, the second one is shallow. A shallow copy of an Array copies only the elements of the Array, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new Array point to the same objects that the references in the original Array point to. In contrast, a deep copy of an Array copies the elements and everything directly or indirectly referenced by the elements.

117. How can you sort the elements of the array in descending order? 
By calling Sort() and then Reverse() methods.

118. What’s the .NET collection class that allows an element to be accessed using a unique key? 
HashTable.

119. What class is underneath the SortedList class? 
A sorted HashTable.

120. How can you overload a method? 
Different parameter data types, different number of parameters, different order of parameters.

More Questions & Answers:-

No comments:

Post a Comment