3. What is the difference between the value-type variables and reference-type variables in terms of garbage collection?

The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null.

4. Where do the reference-type variables go in the RAM?

The references go on the stack, while the objects themselves go on the heap.

6. Speaking of Boolean data types, Whats different between C# and /C++?

There's no conversion between 0 and false, as well as any other number and true, like in C/C++.

8. Whats the difference between Struct and class in C#?

Structs cannot be inherited.
Structs are passed by value, not by reference.
Struct is stored on the stack, not the heap.
Explain encapsulation.
The implementation is hidden, the interface is exposed.

10. How do you initialize a two-dimensional array that you don't know the dimensions of?

int [ , ] myArray; //declaration
myArray = new int [5, 8]; //actual initialization

Download Interview PDF