• Register
3,780 points
9 2

Q1. Define a class and an object.


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.

Q2. List the fundamental OOP concepts.


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.


Q3. Enlist the different types of classes in C#.


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.

Q4. List the steps in code compilation in C#.


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.

Download Free : C# Interview Questions PDF

Q5. Explain the process of Abstraction with an example


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.

Q6. Explain the process of Polymorphism with an example.


Polymorphism is the process when the same method is applied using different implementation techniques. Polymorphism is of two types:

Compile time polymorphism: when an operator is overloaded.

Runtime polymorphism: when an operator is overridden

For example – If a particular class has Void Add (), then polymorphism can be accomplished by the overload technique, then the Void Add() becomes Void Add(int a, int b) and Void Add(int add).

Q7. List down the reason behind the usage of C# language.


There are several reasons for the usage of C# as a programming platform. Some of them are listed below.

Easy to pickup

Component oriented language

Follows a Structured approach

Produces readable and efficient programmes

Once written can be compiled on different platforms

Passing parameters is easy

Q8. What are the advantages of using C#?


Following are the advantages of using C#:

Easy to learn

Object-Oriented language

The syntax is easy to grasp

Component oriented

Part of the .NET framework


// hello, this is a single line comment



/* Hello this is a multiline comment

 last line of comment*/


/// Hello this is XML comment

Q9. What are the different types of comments in C#?


Ans- Below listed are the types of comments followed in C#:

a. Single line comments

b. Multiline comments

c. XML comments

Q10. Illustrate the process of code compilation in C#?


There exist four steps in the process of code compilation:

Compilation of Source code in managed  code

Clubbing the newly created code into assembly

Loading the CLR (Common Language Runtime)

Execution of assembly through CLR

Q11. List down the access modifiers available in C#.


Following are the access modifiers available for general use:

Public- When an attribute or method is defined as public it can be accessed from any part of code.

Private- A private attribute or method can be accessed from within the class itself.

Protected- When a user defines a method or attribute as protected then it can be accessed only within that class and the one inheriting the class.

Internal- When an attribute or method is defined as internal then it will be accessed from that class at the current assembly position.

Protected Internal- When you define an attribute or method as protected internal, then it’s access restricted to classes within the current project assembly or different types defined by that class.

Moving ahead in C# Interview questions, let’s unfold some functionalities used in C#.


Q12. Distinguish between Continue and Break Statement?


Using break statement you can ‘jump out’ of the loop whereas while making use of continue statement you can jump over an iteration and continue the loop execution.

Example (Break Statement):


the number is 0;

the number is 1;

the number is 2;

the number is 3;

the number is 4;

Example (Continue Statement):


the number is 0;

the number is 1;

the number is 2;

the number is 3;

the number is 5;

Q13. What are the different approaches of passing parameters to a method?


There are three ways of passing parameters to a method:

Value Parameters-  Under this method the actual value of an argument is copied to the formal parameter of the function. In, this case the changes made into the formal parameter of the function have no effect on the actual value of the argument.

Reference Parameters- This method copies the argument referring to the memory location into the formal parameter. Meaning changes made to the parameter affect the argument.

Output Parameters- This method returns more than one value.

Let’s move ahead in C# Interview Questions and see the next category.

Q14. Distinguish between finally and finalize blocks?


 finally block is called after the execution of try and catch blocks, It is used for exception handling whether or not the exception has been caught this block of code gets executed. Generally, this block of code has a cleaner code.

The finalize method is called just before the garbage collection. Main priorities are to perform clean up operation for unmanaged code, it is automatically invoked when an instance is not subsequently called.



  • onlineinterviewquestions.com
  • edureka.co
  • indeed.com
  • upgrad.com
3,780 points
9 2