1)

Why strings are of reference type in C#.NET ?


A) To create string on stack

B) To reduce size of string

C) To overcome problem of stackoverflow

D) None of the mentioned

Answer:

Option B

Explanation:

A string does not have a pre-defined memory size, so it requires dynamic memory.  When a string object is created, the actual value is stored within dynamic memory, or on the heap.  To access it, a reference to this memory space is stored in the stack, thus the name "reference type".