C Sharp Interview Questions and Answers - 2

Question: 6

Is string a value type or a reference type?

Reference type with immutable semantics (proof, you can do this: string s= null;)

Question: 7

What are the different types of polymorphism?

There are two types of polymorphism inheritance based and interface based. In inheritance based you have a common base class and in interface based you have a common interface between classes.

Question: 8

Describe the difference between a thread and a process?

A process is a collection of threads (at least one) sharing the same resources (virtual memory, security context, etc.).

A thread is an entity in a process that can actually be executed on the CPU.

Question: 9

What is the difference between Finalize () and Dispose ()?

Finalize () is called by the runtime (the GC) and Dispose () is called by the user.

Question: 10

How do you box a primitive data type variable?

Initialize an object with its value, pass an object, cast it to an object.

Related Questions