C# Interview Questions

C# Interview Questions

C# is a programming language that has been rapidly growing and is being intensively used. It can be used for a number of operating systems such as Windows, iOS, Android, etc. C# is a simple, modern and object-oriented language. Some of the particular syntax used in C# are semicolons, curly brackets, variables (two variable are assigned with the help of an equal sign) and square brackets.

It has a number of advantage and is very user-friendly which makes it one of the most used programming languages in the IT firms. Thus, a number of multinational companies these days are looking for individuals to help them grow in their organization. Thus, such companies ask a diverse range of C# interview questions to not only freshers but also experienced individuals wishing to display their talent and knowledge in the field of C# programming. Here are some important C# interview questions that will not only give you a basic idea of the field but also help to clear the interview.

Download C# Interview Questions PDF

C# Interview Questions

The four steps involved in code compilation in C# are:

  • Compilation of the source code by a C# compiler into the code.
  • Compilation of the newly generated code into the assemblies.
  • Loading of the common language runtime.
  • Execution of the assembly by the common language runtime.
static void Main (string[] args)
string[] languages = { “C#”, “Python”, “Java”)
foreach (string s in languages)
if (System.Text.RegularExpressions.Regex.IsMatch(s, “Python”))
Console.WriteLine(“Match found”);

Exception handling can be implemented in C# using the following keywords:

  • try
  • catch
  • finally
  • throw

Some of the basic string operations are:

  • concatenate
  • modify
  • compare
  • search

The different stages of a thread are:

  • Unstarted
  • Running
  • WaitSleepJoin
  • Suspended
  • Aborted
  • Stopped

Abstraction is the process that is used to highlight an important feature of the class that can hide the irrelevant information.

For example – A driver of a car ought to know the details of the car such as its brand name, color, gear, brake, etc. However, the information that is not of importance to him are details of the car such as the exhaust system, internal engine, etc. Thus, the process of abstraction helps in identification and extraction of the information that is relevant to the user and not needed from the outside world. A number of parameters such as with the usage of “private” keyword can help in hiding internal information.

Different types of delegates used in C# are:

  • Single Delegate: a delegate that can utilize only a single method
  • Multicast Delegate: a delegate that can utilize multiple methods

A generic class is utilized to generate classes or objects that do not have a precise type of data. However, the data type can be assigned anytime while using the program.

Some of the properties of a thread class are:

  • IsAlive
  • Name
  • Priority
  • IsBackground
  • ThreadState

C# is a programming language which is object-oriented developed by Microsoft. C# is designed and fabricated for a Common Language Infrastructure that constitutes an executable code and runtime, which allows the usage of different high – end languages for different platforms and design.

Some examples of I/O classes are:

  • File: used in manipulating a file
  • StreamWriter: used for writing different characters into a stream
  • StreamReader: used for reading characters off a stream
  • StringWriter: used for reading from a string buffer
  • StringReader: used for writing into a string buffer
  • Path: used for execution of different operations that are related to a path data

The four types of classes in C# are:

  • Partial class: Allows its associates to be separated or shared with different.cs documents. It is indicated by the keyword “Partial”.
  • Sealed class: It is a class, which cannot be acquired. To get to the member from a fixed class, we have to make the object of the class. It is indicated by the keyword “Sealed”.
  • Abstract class: It is a class where the object cannot be instantiated. This class can be acquired; however, it should have at least one technique. It is indicated by the keyword “conceptual”.
  • Static class: It is a class, which does not permit legacy. The members of the class are additionally static. It is indicated by the keyword “static”. This keyword advises the compiler to check for any unplanned instances in the static class.

Some characteristics of an array class are Length, IsFixedSize, IsReadOnly.

A class is an example of properties and techniques that utilize and characterize a continuous substance. It can represent information that unites each illustration into a single component. An Object is a sub-occurrence of a Class. In fact, it is only a square of memory assigned that can be put away as Variables, Array or a Collection.

The fundamentals of an OOP concept are:

  • Encapsulation: The internal portrayal of the object is concealed from the predators view from the definition of the object. Only the information that is required can be retrieved whereas the rest of the data is kept hidden.
  • Abstraction: It is a procedure of distinguishing the basic conduct and information of an object and disregarding the insignificant details.
  • Inheritance: It is the ability to make new classes from a different class. It is carried out by retrieving, altering and broadening the conduct of the objects in the parent class.
  • Polymorphism: It implies one name with numerous structures. It is accomplished by having numerous techniques with a similar name with dissimilar usage.