C# Interview Questions and Answers Part 11

1. What are the difference between Structure and Class?


1. Structures are value type and Classes are reference type.

2. Structures cannot have contractors or destructors. Classes can have both contractors and destructors.

3. Structures do not support Inheritance, while Classes support Inheritance.


2. What are the difference between const and readonly?


1. A const cannot be static, while readonly can be static.

2. A const need to be declared and initialized at declaration only, while a readonly can be initialized

  at declaration or by the code in the constructor.

3. A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.

3. What is the difference between Serialization and Deserialization?


Serialization is a process of converting an object or a graph of objects into a linear sequence of bytes for

either storage or transmission to another location

Deserialization is the process of taking-in stored information and recreating objects from it.

4. What is IL? (What is MSIL or CIL, What is JIT?)

Ans. MSIL is the CPU –independent instruction set into which .Net framework programs are compiled. It contains

instructions for loading, storing initializing, and calling methods on objects.


5. What is CLR?

Ans. CLR also known as Common Language Run time provides a environment in which program are executed, it activate object, perform security check on them, lay them out in the memory, execute them and garbage collect them.


6. What is CTS?

Ans. The common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages.


7. How many classes can a single .NET DLL contain?

Ans. It can contain many classes.

8. What are the types of comment in C#?

Ans. There are 3 types of comments in C#.

Single line (//), Multi line (/* */)and Page Comments (///).

9. What is an ArrayList?

Ans. The ArrayList object is a collection of items containing a single data value.

10. How many values can be returned from a method in C#?

Only one value can be returned from method, however you can use ref or out variable to change more than one

value in called method.


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker