Interview Questions and answers in C Sharp


Finalize is called by System. Dispose is called explicitly by programmer. Both are used for grabage collection.

Difference between System.Collections and System.Collections.Generics

We can use array to store the values but it stores only values of one type and size of array is also fix. So they introduced System.Collections which allows us to store different types. e.g. in ArrayList, we can store different types of data and also size is not fixed. But that brings other disadvantage. Type Safety is not guaranteed. To overcome this problem, they introduced System.Collections.Generics. e.g. List Generics provide 3 benifits over array - variable size, type safety and parameterized types


LINQ stands for language integrated query. We can query the objects using sql like syntax.

Explain delegates

delegates are function pointers

Types of classes

  • - Partial class
  • - Sealed class
  • - Abstract class
  • - Static class

What do you mean by .net Framework

Code is compiled and converted into assembly. CLR (common language runtime) runs the asssembly. Here is the list of .net framework versions
  • .net framework 2.0 = FCL(Framework Class Library) + CLR (Common Language Runtime)
  • .net framework 3.0 = WPF + WCF + WF + Card Space
  • .net framework 3.5 = LINQ + Entity Framework
  • .net framework 4.0 = Parallel LINQ + Task Parallel Library
  • .net framework 4.5 = .Net APIs for Store + Task based Async model

What is Jagged Array

Array inside array is called as Jagged Array.

Properties in - getters and setters?

Getters and Setters allows you to get and set the values of the properties of the object.

Partial classes in

We can split class definition using partial keyword

Passing by value and ref - ref vs out

list of value types
  • - bool, byte and sbyte , char
  • - decimal, double,float
  • - int, long, short,
  • - uint, ulong, ushort
  • - struct
  • - enum
list of ref types - All Objects including strings

What is Serialization

Process of converting object into stream of bytes or storing object on file. Deserialization is the reverse process.

Difference between const and read-only

When we declare a variable as const, it can be assigned only once. In case of read only variable, it can be assigned through static constructor.

Difference between System.String and System.Text.StringBuilder/StringBuffer

System.String is immutable. StringBuilder is mutable. StringBuffer is thread safe.

What is a Sealed Class

The class that can not be in inherited.

difference between method overloading and overriding

In overloading (early binding), method names are same but signature is different. In overriding (late binding), same method is defined in base class and inherited class.

difference between internal and protected internal

internal properties can be accessed from same assembly. protected internal properties can be accessed from only inherited class in same assembly

difference between System.Array.CopyTo() and System.Array.Clone()

In clone, new object is created. In CopyTo, existing object is used to copy elements.

Difference between Abstract Class and Interface

In Interface, only public declarations are avialable. In Abstract class, private methods can be available. Abstraction - hiding implementation details Encapsulation - hiding the members e.g. data and grouping the data and methods together.

Difference between float, double and decimal

Precision is the difference between these data types. Decimal is used to store money data. float - 32bit, double - 64 bit, decimal is 128 bit long.

Using keyword

- to add the namespace - to dispose the object automatically after use.


Hashtable is like a dictionary object. Item is stored using key,value pairs.

Finalize vs Dispose

Explain attribute and usage

C# attributes are similar to annotations in Java. e.g. In Unit testing framework, we have TestClass attribute which means given class contains test methods. We can extract this information using reflections.

difference between is and as

is returns boolean value telling compatibility of 2 objects. as operator casts the object from one type to another.

Boxing vs Unboxing

Boxing means converting of value type to reference type. Unboxing is the reverse process.

Challenges, Achievements

  • People - Some people not responding to the requests.
  • Process - People not following the process e.g. In Jira, ticket status should be updated.
  • Technical - Synchronization, false positives tests, Cross browser and platform compatibility

Web development and Automation testing

solutions delivered!!