Set - 10

Question 16 :

What's the top .NET class that everything is derived from?

Answer :



Question 17 :

What does the term immutable mean?

Answer :

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.

Question 18 :

What's the difference between System.String and System.Text.StringBuilder classes?

Answer :

System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

Question 19 :

What's the advantage of using System.Text.StringBuilder over System.String?

Answer :

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. 

Question 20 :

What's the difference between the System.Array.CopyTo() and System.Array.Clone()?

Answer :

Explanation :

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.