C# Interview Questions and Answers For Experienced and Fresh Candidates

C# Interview Questions and Answers For Experienced and Fresh Candidates. If you are looking for right and well defined interview questions relating to your interview then you are in that place. These C# interview questions are especially designed in that way how you can get familiar with these interview questions and what type of requirements you need to satisfy your interviewer during interview.


You may like our recent post about All about AngularJS Interview Questions and answers.

C# Interview Questions and Answers

We have captured and collected a lot of information’s, data ,tips ,skills, conditions, requirements, practical objects info and also downloaded different books regarding these C# interview questions and merged all of these information’s into one suitable and well explained article that is related to your required questions.

Before we continue to explore everything regarding these interview questions, remember to prepare yourself in that way if interviewer looks at you and think that how you are well dressed with attractive personality. We have seen many interviews where answers were not satisfied but they qualified because of their personality, manners and dressing. So now we can go to our subject and will try to explain everything in your desired expectations.

c #interview questions and answers

Tell me Namespace of C# –

Question frequently asked from Freshers

It is designed to provide a way how to separate one set of names from another set. Here class names in one namespace do not squabble with another same class names.

What is the answer of this program?

delegate void Printer();


static void Main()


List<Printer> printers = new List<Printer>();

for (int i = 0; i < 10; i++)


printers.Add(delegate { Console.WriteLine(i); });



foreach (var printer in printers)





First of all delegate is required to add in the for loop and the pointer “I” is stored in such a way that when we close the loop, “I” has been target to set value of 10.When each delegate is referred to, the result of the value will be 10, so the answer will be 10.

How you will explain serialization in C#?

Serialization basically is a process of converting different types of objects using the stream of bytes. In this process a network is required to complete this procedure using serialize interface technique. If interviewer is looking for De-Serialization then the answer will be reverse of Serialization.

There are three types of serialization which are binary, soap and Xml serialization. Binary serialization is used to save data in binary format. Soap serialization is used to save data in binary format and mainly used in network communication. Xml Serialization is the major type of serialization which is used to save object data in Xml file.

Tell me short info about method overloading

When we create multiple methods using the same signatures with the same name in well defined same class, then compiler is used to determine the specific method with the help of overload resolution. This is called method overloading and it is the most asked question in interviews in our point of views.

Tell me difference between Array and Arraylist

Describes little bit about reference types in C#?

In reference types, the actual data is not stored in a variable but a reference is invoked to the variables. We can say that memory location is referred by these reference types even using multiple variables.

If we encounter the data changing by one variable in memory location, the other variable is always ready to compensate this change into required value. String, object and dynamic are different built in reference type’s use in C#.

What is encapsulation?   

Encapsulation is a programming method in C# where different atoms are packed by physically or logically. Basically in my point of view it is the technique which prevents access to execute important details and information’s.

What you know about custom exceptions?

Custom exceptions are used to reduce encountered errors in our programming as per needed requirements and also known as defined exceptions.

Tell me main difference about a struct and a class

Here is the easiest question in your C# interview questions process and I think don’t need any answer. But we are exploring everything to answer each question so the answer will be like this:

Structs are stored and invoked on the stack producing more overhead with the faster correction availability and has no ability to transferred. Classes are reference types which already explained.

What is jugged Array in C#?

Jugged Array is also called “array of arrays” and have different dimensions and sizes to store rows of object data with different magnitude and length to better the performance of the system in case of working with multiple arrays. A jugged array uses different lengths array in C#.

c #interview questions and answers


What is Hash table in C#?

Hash table in C# is used to store keys and values which describes the storage location and can’t be changed with any duplicate pairs of keys and values. The hash table acts like a dictionary collection. Don’t give more details about this question. For easy understanding, see example

c #interview questions and answers

What are access modifiers in C#?

In C# following are the access modifiers that typically are used.

  1. Protected 2.Public 3.Private 4.Internal 5.Protected Internal
  2. Protected If you use an attribute as protected then there is a chance of getting it from any method within the same class.
  3. Public If you use an attribute as public then it can be gained by any code in the same class only.
  4. Private It can be accessed by any code within the same class only
  5. Internal It is restricted in the current assembly
  6. Protected Internal It is restricted in the current assembly or can be accessed from the same class only

What is Sealed Class in C#?

The sealed class is used to create other classes and incomplete members and is used in derived class that can’t be inherited from other classes. For this a sealed modifier is used to avoid overriding.

c #interview questions and answers

What is constant and readonly variable in C#?

Constant variable is not used for modifying the code because it is assigned then there will be no chance of changing so only used for making entity constant and value assigning.

Readonly variable is used for modifying and changing the code even during run time or not and can be assigned any time.

Tell me Nullable types in C#

Nullable data types are used to assign special range of values including null values too. For exp, you can store from -3,185,698,523 to 3,185,698,523 or nullable<INT32>.

What are the advantages and disadvantages of LINQ in C#?

Sometimes interviewer asks such questions in C# interview questions procedure that look easy but have obviously standard value. This question is one of them and pretty attractive for you. So the answer will be like this.

c #interview questions and answers

Tell me main reason of using C# language

Here are some reasons why C# language is used.

It is easy to learn as compared to other languages.

This is object oriented programming language and most powerful

Components used are oriented

Structured language is used

Easy to Compile

Take a breath here and read about Top SSIS Interview Questions and Answers with examples.

What is the class that is used as a base class in c#?

Most C# exceptions are recognized and defined by classes. These classes are acquired directly or indirectly from the whole system exception class. These derived system exception classes are system application exception and system system exception classes.

What are the comment types in C#?

  1. Single line
  2. Multiple line
  3. Xml comments

What is constructor?

A constructor can be defined as a member function having same class with the same name in that class. It is automatically called during the process of creating object class. A constructor is used to build the values of members when class is initialized.

What you know about lock statement?

In lock statement one thread remains in critical section while other doesn’t need to enter the critical section code but if first one tries to enter a locked section code then there will be a wait until the process is completed and object is free to release.

Tell me about Reflection in C#?

A process where metadata is inspected by runtime type discovery such as late binding CIL coding called reflection. Here same type of information’s can also be accessed by specific utility at design time.

Here are some system reflection namespaces.

Assembly: This class is used for loading, investigating and manipulating.

Eventinfo: This class gives information’s about current events.

Methodinfo: This class provides specific information about a specific method.

Propertinfo: contains information’s about a specific property

Define custom control and user control

The controls that are generated as compiling the codes are called custom controls. These controls are user friendly and are easy to use without getting any error in the program and also can be transferred to toolbox. These controls can also be used in multiple applications and also or designing the attributes. These are easy to drag and copy the files.

User Controls are easy to use and create the files but can’t be dragged and dropped with no placing in toolbox. User controls have their own design and code behind.

What is the usage of conditional preprocessor directive?

#if directive is used to make a conditional directive. These directives are used for checking and testing the symbols if they are working or need some corrections to get true results by evaluations. If the results are true then compiler immediately evaluates all the code between #if and the next one directive.

What you know about objective Pool in C#?

Objective pool is used to make a pool of data objects and can be located in memory for later reusing that will result in reducing the load of object.

When new request is created for the object, this request is captured by pool manager and is used by allocating the object. If there is no object available, the process will stop and will need further commands to start.

How to access protected internal?

Protected internals are basically methods that can be accessed within the same assembly and classes.

How you will declare property in a class? Write the code

int m_PersonID = 0;

public int PersonID


get { return m_PersonID; }

set { m_PersonID = value; }



How you will define interface?

Interface can be defined as a syntactical contract in which all the classes should follow the rules and regulations during inheriting the interface. The interface describes briefly the “what” part of the most used syntactical contract.

Interface is used to define properties, variables, different evens and methods because these are members of interface. Also help to provide standard structure of the deriving classes.

What is “IS” and “AS” operator in C#?

“IS” operator in C# is used to check what the object type is. In this case, if two objects have the same type then it will true and false if not.

The “AS” behaves like “IS” operator with the little difference of object is returned if both are compatible otherwise result is null.

What is main difference between equality operator and equals method?

Both are used for comparing value type data items and also reference type items. So we can say that equality operator is the comparison operator and the next one equal’s method is used to compare the contents of a string.

How you will sort the elements of array in descending position?

It can be solved by using Sort () methods with the help of reverse () methods.

How you will differentiate between static, void and public?

Static declared variables can be accessed globally without any issues and new file creation of the class.

Public declared variables can be accessed anywhere in the application.

Void eventually a modifier which means method can’t return the data type value.

After reviewing these c# questions and answers with detail examples, it will be easy for you to site in front of the  Job interviewer and answer him correctly and fluently.

Leave a Reply

Your email address will not be published. Required fields are marked *

Interview Questions © 2017 Frontier Theme