Skip to main content

C# Interview Questions

1. Does C# support multiple-inheritance?

Answer: No

2. What is the top .NET class from which everything is derived?

Answer: System.Object

3. What is the difference between String and StringBuilder classes?

Answer: String is immutable. If we update value in string variable then always new instance is created instead of updating actual variable. StringBuilder is mutable. We can update same variable multiple times

4.Explain differences between Array list and Hash table?

Answer:

a) Hash table arranges data as key value pair. Array list work on objects. Array list does not support key value pair.
b) Using the key we can access its value from hash table while in Array list we can access using index
c) Hash table is faster than Array List.

5.List the memory types in .net?

Answer: Two types are there in .Net:
Stack
Heap

6.What is boxing and unboxing in .Net?

Answer: Boxing is a process where value type is converted into reference type. Unboxing is a process where reference type is converted into value type.