MUST Have C# Interview Questions and Answers

By | March 11, 2017
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInDigg thisPin on Pinterest

This C# Tutorial is focused on C# Interview Questions with practical and detailed answers. We already have published detailed Technical Tutorials on ASP.NET, ASP.NET MVC, Entity Framework, ASP.NET Web API and other related Interview Questions tutorial series to clarify all related concepts. Also, one can find Online Practice tests and exams on C# and related. We are focused to provide more practical details with real time scenarios and complete source code in order for user to grasp C# language concepts.C# Interview Questions and Answers

C# Interview Questions PDF version will be available later for download.

Following Technical Interview Questions and Answers will also be helpful.

Complete C# Interview Questions List

Explain an Interface and a Class in C#?

Class in C#:

A C# class is a group of methods and variables enclosed by pair of curly braces. Class is also defined through properties and methods used in OOPS. In other words, we can say it acts as a template for creating objects.

Following is a Class (i.e. Employee) written in C#:

Interface in C#:

In C# Interface look like the class but it only contains method’s signature instead of actual implementations. Unlike the class, Interface cannot contain method body because all the method inside the interface are declared abstract.

Interface is mainly used for achieving the multiple inheritances that cannot be possible by using class. It is also used for achieving fully abstraction.

It is compulsory to define interface method in inherited class with public keyword and as we know interface is not class then it’s impossible to create instance of interface.

C# Program Output:

Back to top

What are the Value Types and Reference Types in C#?

In .NET, data types are define in two ways.

  1. Value Type
  2. Reference Type

Value Data Type:

The value data type has its own default value and a storage range for each member. Just like int has default value 0 and float has default value 0.0f.

Predefined Data Types User Defined Data Types
int, char, float, Boolean etc Structure, Enumeration

Reference Data Type:

The reference data type store only a reference of a memory location that contain actual data. It cannot contain the actual data stored in variable, so we can say that a reference behaves like a key to referenced data.

Predefined Data Types User defined Data Types
Object, String Class, Interface, Array & Delegates

Back to top

What is a Sealed Class?

Sealed is a keyword which used to apply the restriction on the class and method.

  • If we use sealed on the class it cannot be inherited or derived.
  • If we use sealed on the method it cannot be overridden.

Sealed Class Example:

Consider the below example, where Bike is a sealed class. If we try to override any of it’s method, it will give a compile time error.

Note: sealed keyword applied on Bike class hence it cannot be inherited by child class or derived class.

Back to top

Explain Method Overloading in C# with the help of an example?

Method overloading means using two methods with the same name in a single class. In C# method overloading also known as Compile Time Polymorphism that means we overload during compile time.

In C# there is three way to overload a method

  • Change the signature of method
  • Change the data types in parameterized method
  • Change numbers or the data type in parameterized method.

Method Overloading Example:

Back to top

Briefly explain Access Modifiers in C#?

Access modifiers are keywords which used to specify the protection or security level of the class or access of a class.

There are 5 access modifiers in C#.

  • public
  • private
  • protected
  • internal
  • protected internal

public Access Modifier:

It is the most common access modifier of all; it can be access anywhere within the class or outside of the class and within the assembly or outside the assembly.

private Access Modifier:

It allows restricting the use of the method and data member only within the class.

  • That’s mean if we declare any method or field as a private it can be accessible only within the class.
  • If we declare any constructor as private then you cannot create an object of the class outside of that class, its mean main method must be inside the same class in which constructor declared as private.
  • If we declare any class as private, it is mandatory to declare the main method in the same class to create the object of that class.
The above code will give the compile time error because we are trying to access data member and method from outside of the class. And also we are trying to create the object of class from outside of the method.

Solution to above Issue:

protected Access Modifier:

Protected modifier allows to accessing data member and method within the same class as well as outside of its derived class within the same assembly. That’s mean it can be accessible outside of the class only using inheritance.

internal Access Modifier:

It allows accessing method and data member within the class as well as outside of the class even without using inheritance that’s mean no matter that another class is derived or not. The only thing that matters, is that classes must lie within the same assembly.

protected internal Access Modifier:

It allows accessing the data member and method within the class and outside of the class. Here assembly doesn’t matter, it can be accessed outside the assembly also but only inside the derived class. That’s mean another assembly should contains derived class of that class.

Back to top

What is Static Keyword in C#?

Static is keyword or modifier that can be used with data members, methods and also with class. It is mainly used for memory management. It will not get memory each time when the instance is created; we don’t need to create the instance of the class for accessing the static member of the class because it belongs to the class area rather than an instance of the class.

static as field:

  • If you declare the static keyword with the data members, it is called static data member or static field.
  • Unlike the instance data member, it will not get memory each time when the instance of the class is created.
  • There is only one copy of it is created in memory which is used to share the common property to all the objects.
  • It can be changed only inside the static method.

static as Method:

If we declare any method as a static then,

  • It belongs to the class rather than instance of the class
  • It can access only static data members.
  • It can call only other static member and cannot call a non-static method.
  • It can access directly by the class name, don’t need to create an object.
  • It cannot refer to this and super keyword.

static with Class:

When a class declared as a static then,

  • It can contain only static members and it cannot be instantiated.
  • It is sealed.
  • Cannot contain instance constructor.
  • Provides us guarantee that instance cannot be created of static class.
Back to top

What is Serialization and De-Serialization? Explain Serializable Attribute in C#?

Serialization is a mechanism of converting the object into byte stream so that it can be saved to memory, file or database and it’s reverse mechanisms called de-serialization.Serialization in CSharp


To serialized an object necessary to use SerializableAttribute attribute to type.

Serialization Exception is thrown at the runtime if we don’t apply the SerializableAttribute.

Now the serialized data will stored in the file. If we want to get data (or file), we have to perform deserialization.

Note: here, we are using BinaryFormatter.Serialize(stream, reference) method to serialize the object.


Deserialization is the reverse process of serialization that’s mean it convert the byte stream data into the object. Now we will use Binary.Formatter.Deserialize(Stream).

Output:   1 Ahmad

Back to top

What is a Jagged Array in C#?

A jagged array is an array whose elements are itself arrays. That means jagged is an array of array. Also, the elements of an array can be different in size and dimension.


Note: Jagged array can contain the elements in the form of single & multidimensional array. Below example is a single dimension jagged array contains multidimensional array’s elements.

Back to top

What are Nullable Types?

Nullable is a special type of variable provide by c#, in which you can store the normal range values as well as null value.

  • You can store any numeric data type in range from -2,147,483,648 to 2,147,483,647
  • You can store null value <data type>?<variable name>=null;
  • You can store Boolean data    bool? Value=new bool?();
Back to top

What is a circular reference?

A circular reference is a series of references when a formula refers back to its own cell, either directly or indirectly and last object references the first, resulting in a closed loop. Also it is run around where in two resources independent on each other.

If a group of objects contain references to each other, but none of these objects are referenced directly or indirectly from stack or shared variables, then garbage collection will automatically reclaim the memory.

The methods to deal with circular references are:

  • Weighted references counting
  • Indirect reference counting

There are some ways to handle the problem of detecting and collecting circular references with the help of garbage collection.

  • The system may explicitly forbid reference cycles.
  • Systems ignore cycles if it have small amount of garbage collector cycles.
  • You can also periodically use a tracing garbage collector cycles.

Weighted References Counting:

  • An object has a weight
  • Assign weight to each pointer
  • Object weight=sum of the pointer’s weight
  • When the pointer is copied, evenly distribute the weight
  • When a pointer is deleted, the weight of the pointer is subtracted from the weight of the object
  • An object is garbage collected when its weight becomes to 0.

Back to top

  • Learn ASP NET MVC 5 step by step [Maruti Makwana, Corporate Trainer] 28 Lectures, 2.5 Hours Video, Intermediate Level
    Very easy to learn video series on Asp.Net MVC 5 Specially for those who are familiar with Asp.Net Web forms.
  • AngularJS for ASP.NET MVC Developers [Brett Romero] 10 Lectures, 1 hour video, Intermediate Level
    The Fastest Way For .NET Developers To Add AngularJS To Their Resume
  • ASP.NET with Entity Framework from Scratch [Manzoor Ahmad, MCPD | MCT] 77 Lectures, 10 hour video, All Level
    Latest approach of web application development
  • Comprehensive ASP.NET MVC [3D BUZZ] 34 lectures, 14 Hours Video, All Levels
    From zero knowledge of ASP.NET to deploying a complete project to production.

Continue with More C# Interview Questions here:

What is an Object Pool?

An object pool is container object that contain the list of other objects which are ready to be used.

  • It contain the record of currently used object
  • It contain the number of objects in the pool
  • It reduces for creating and recreating object each time by re-using objects from the pool.
  • Each time it will check in the pool (Queue) either the object is available or not, it reuses the object if available in the pool otherwise will create the new object.

Back to top

What is a Multicast Delegate? Explain with Example.

Delegate is a reference to the method that is work like function pointer in C & C++ but it is objected, oriented, secured and type safe than function pointer.

A multicast delegate is a extension of normal delegates and use to call the more than one method at a single time using delegate object.

  • It encapsulates method only for the static method and for the instance method, it encapsulates both the method as well as instance.
  • It is more helpful to use in event.
  • It resolve the problem of heavy coupling at time of adding of new method in business layer.
Back to topC# Unity Developer

What are Extension Methods in C#?

An extension method is a special type of method that allows you to add method of existing types without creating a new derived type, recompiling or otherwise modifying the original type. They are called if they were instance method on the extended type.

It is the static method of static class, where the modifier is applied on the first parameter and the type of first parameter will be the type that is extended.

Way of using extension method

  • Extension method cannot be used to override the existing method
  • The concept of extension methods cannot be applied on the field, properties or event.
  • It must be define in a top level static class.
  • It shout not be same name & signature like instance method.

Back to top
This C# Tutorial Series is continued and you can find more C# Interview Questions in Next Web Development Tutorial here.

Top Technical Interview Questions and Answers Series:

Top C#.NET Jobs [Updated Daily]


Software Engineer – Full Stack
Source: Indeed
Details: 5-7 years of experience with the Microsoft .NET UI development stack (ASP.NET MVC & WCF). At Upfront, we make every visit valuable for patients and providers....  More
2 days ago

Chicago, IL 13-December-2017

Full-Stack Software Engineer, ASP.NET
Source: Indeed
Details: C#, ASP.NET MVC, Entity Framework, SQL Server. Ideal candidates have demonstrable experience building highly scalable, secure applications leveraging the ASP...  More
30+ days ago

New York, NY 17-October-2017

C# Software Engineer
Source: Indeed
Details: 1+ years of experience with web development with ASP.Net MVC and JavaScript. CRISP - The State of Maryland Health Information Exchange is a regional health...  More
30+ days ago

Columbia, MD 13-September-2017

Software Development Engineer
Source: Indeed
Details: Experience implementing a RESTful API using ASP.NET MVC 4. We are seeking a talented Software Engineer to contribute to the development and maintenance of an...  More
30+ days ago

Des Moines, IA 06-November-2017

Software Development Engineer II - 4071
Source: Indeed
Details: Experience with ASP.NET MVC (especially Razor views and HTML helper extensions). ISoftStone North America is seeking a Software Development Engineer II to join...  More
4 days ago

Redmond, WA 12-December-2017

Software Engineer
Source: Indeed
Details: You will use your technical expertise and problem solving skills to develop a wide variety of operational grade software solutions (i.e., ASP .NET MVC web...  More
10 days ago

Herndon, VA 05-December-2017

Software Engineer
Source: Indeed
Details: Proficiency with ASP.NET MVC, C#, and SQL. Is the leading Digital Health technology company servicing the needs of the emergency and public safety industries....  More
24 days ago

Broomfield, CO 80021 21-November-2017

Software Engineer
Source: Indeed
Details: C#, ASP.NET MVC and/or Java. This position will exercise the applicant’s skills as a software engineer in both the commercial and government space....  More
30+ days ago

Johnstown, PA 15904 19-October-2017

Software Engineer
Source: Indeed
Details: NET, ASP.NET MVC and Razor Syntax. About the Role*....  More
30+ days ago

Columbus, OH 19-October-2017

Software Engineer
Source: Indeed
Details: API first design and SPA applications with Angular, Web API and ASP.NET MVC. NCARB’s Information Systems (IS) Directorate has an opening for a Software Engineer...  More
30+ days ago

Washington, DC 20006 13-October-2017

Software Engineer
Source: Indeed
Details: _Experience with Microsoft .NET C# and ASP.NET, MVC, & Entity Framework_. Intellicheck Mobilisa is a publicly-traded technology company located in Jericho, NY...  More
30+ days ago

Long Island, NY 05-September-2017

Senior .NET Consultant
Source: Indeed
Details: EPE Innovations is a software development and consulting company, with a primary focus on Complex Data Modeling, Data Analytics and Business Intelligence...  More
7 hours ago

Houston, TX 15-December-2017

Senior .NET Consultant
Source: Indeed
Details: ASP .Net MVC.:. Strong knowledge of our core technology stack including n-tiered .Net development, TFS, MVC C# .NET, .NET Entity Framework, WCF web services, MS...  More
1 day ago

Albany, NY 14-December-2017

ASP.NET MVC Web Developer
Source: Indeed
Details: Strong or expert knowledge of C#, JQuery, JavaScript, Knockout JS, ASP.NET MVC, MSSQL. Perform in a key role in the development and enhancement of enterprise...  More
14 days ago

Evanston, IL 01-December-2017

Associate Software Engineer
Source: Indeed
Details: Experience with .NET Framework (ASP.NET, MVC, WinForms). American Healthtech, a growing software technology company, is searching for an *Associate Software...  More
7 days ago

Ridgeland, MS 39157 08-December-2017

Software Engineer Associate
Source: Indeed
Details: Familiarity with Angular, Entity Framework and ASP.NET MVC. 30% Application Development*....  More
15 days ago

Dallas, TX 30-November-2017

Software Engineer I
Source: Indeed
Details: Knowledge and experience with .NET MVC and web-based development. .NET 4 or greater, ASP.NET MVC 4 or greater, javascript frameworks such as JQuery....  More
7 days ago

Ridgeland, MS 39157 08-December-2017

ASP.NET Web Developer
Source: Indeed
Details: C# and ASP.NET MVC programming:. Develop new MVC applications conforming to the design specifications provided....  More
30+ days ago

Orlando, FL 08-November-2017

.Net Developer (C#, ASP.Net)
Source: Indeed
Details: 2+ years' experience with ASP.NET MVC, at least 1 year using the 4-4.5 framework. This individual will assist with the development and maintenance of detailed...  More
18 days ago

Nashville, TN 27-November-2017

.Net Developer (C#, ASP.Net)
Source: Indeed
Details: 2+ years' experience with ASP.NET MVC, at least 1 year using the 4-4.5 framework. Proficient working with the following - .NET, C#/VB, SSMS, Object Oriented...  More
18 days ago

Cleveland, OH 27-November-2017

Sr. Software Engineer
Source: Indeed
Details: Experience with ASP.NET MVC. Looking for a highly skilled software engineer to provide technical leadership on its critical communication software suite....  More
8 days ago

Eden Prairie, MN 07-December-2017

Sr. Software Engineer
Source: Indeed
Details: Experience with ASP.NET MVC. Client is looking for a highly skilled software engineer to provide technical leadership on its critical communication software...  More
30 days ago

Eden Prairie, MN 15-November-2017

Sr. Software Engineer
Source: Indeed
Details: Extensive Experience with ASP.NET MVC using C#.NET. We are looking for a Sr....  More
30+ days ago

San Jose, CA 01-November-2017

Sr. Software Engineer
Source: Indeed
Details: Full stack development experience using C#, ASP.Net, MVC, WCF, REST APIs, SQL Server, JavaScript Frameworks, HTML5, CSS3,. Local Candidates Preferred....  More
30+ days ago

Burbank, CA 22-September-2017

Senior .NET Programmer/Analyst - 5+ Yrs Experience - Philadelphia, PA
Source: Marshall Dennehey Warner Coleman & Goggin, P.C.
Details: A minimum of 5 years experience in application design and development using a variety of .NET technologies and languages, including C#, VB.NET, Javascript,...  More
30+ days ago

Philadelphia, PA 26-October-2017
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInDigg thisPin on Pinterest