31+ C Sharp Interview Questions

31+ C Sharp Interview Questions

C# Interview Questions

1) What is C#? 

C# is a basic, present day, universally useful programming language. It is an article situated programming language created by Microsoft. It is a safe and overseen language that is aggregated by .NET system to create Microsoft middle of the road language (machine code).

2) What is the explanation for the creation of C#? 

C# is intended for Common Language Infrastructure (CLI). It contains the executable code and runtime condition that makes the clients ready to utilize different abnormal state dialects on various PC stages and designs.

3) What are the principle motivations to utilize C# language? 

These are top motivations to utilize C# language:

Simple to learn

Broadly useful and object situated programming language

Segment arranged

Organized language

Can be aggregated on assortment of PC stages

Produces effective projects

Some portion of .net structure

4) What is the contrast between open, static and void? 

You can get to open announced factors anyplace in the application.

Static pronounced factors are comprehensively open without making a case of the class.

Void is a sort modifier that indicates that the technique doesn't restore any esteem.

5) What are constructors in C#? 

A constructor is a part work in the class and has a similar name as its class. At whatever point the article class is made, the constructor is naturally summoned. It builds the estimation of information individuals while introducing the class.

6) What are the distinctive kinds of constructors in C#? 

Fundamentally, there are five sorts of constructors:

Static constructor

Private constructor

Duplicate constructor

Default constructor

Parameterized constructor

7) What is static constructor? 

Static constructor is utilized to instate static information individuals when the class is referenced first time.

8) What is technique over-burdening in C#? 

Technique over-burdening is component to make different strategies with a similar name and special mark in a similar class. When you go for gathering, the compiler utilizes over-burden goals to decide the particular strategy to be summoned.

9) Is superseding of a capacity conceivable in a similar class? 

No

10) What is cluster? 

Cluster is a lot of related cases either esteem or reference types.

There are three sorts of exhibit bolstered by C#:

Single Dimensional Array: It contains a solitary line. It is otherwise called vector exhibit.

Multi Dimensional Array: It is rectangular and contains lines and sections.

Barbed Array: It likewise contains lines and segments yet it has a sporadic shape.

11) What is ArrayList? 

ArrayList is a dynamic cluster. You can include and expel the components from an ArrayList at runtime. In the ArrayList, components are not naturally arranged.

12) What is a gathering? 

A gathering functions as a compartment for examples of different classes. All classes execute ICollection interface.

13) What is an interface? 

Interface is a unique class that has just open dynamic strategy. These strategies just have statement not the definition. These theoretical techniques must be executed in the acquired classes.

14) What is the lock articulation in C#? 

Lock articulation is utilized to guarantee that one string doesn?t enter a basic area of code while another string is in the basic segment. In the event that another string endeavors to enter a bolted code it will pause, obstruct, until the item is discharged.

15) What is serialization? 

In the event that you need to transport an article through system, at that point you need to change over the item into a surge of bytes. The way toward changing over an item into a flood of bytes is called serialization.

16) How to pronounce a property in a class? 

int m_PersonID = 0;

open int PersonID

{

get { return m_PersonID; }

set { m_PersonID = esteem; }

}

17) What is the distinction between early official and late authoritative in C#? 

Early official and late restricting are the idea of polymorphism. There are two kinds of polymorphism in C#.

Order Time Polymorphism: It is otherwise called early official.

Run Time Polymorphism: It is otherwise called late official or technique abrogating or dynamic polymorphism.

18) Which are the entrance modifiers accessible in C#? 

Following are the entrance modifiers for the most part utilized for openness:

Open: If you characterize a characteristic or technique as open, it tends to be gotten to from any code of the task.

Private: A private characterized quality or technique can be gotten to by any code inside the containing class as it were.

Ensured: If you characterize the strategy or quality as secured it tends to be gotten to by any technique in the acquired classes and any technique inside a similar class.

Inner: If you characterize a quality or a technique as inward, it is confined to classes inside the present position get together.

Secured inward: If you characterize a quality or technique as ensured inside, get to is confined to classes inside the present undertaking get together or types got from the containing class.

19) What is the distinction between unique class and interface in C#? 

Unique class can have conceptual and solid techniques while interface has just dynamic strategies.

20) What is the contrast among arrange() and settle() techniques in C#? 

The arrange() strategy is expressly called by client to free unmanaged assets, for example, documents, database associations and so on though finish() technique is certainly called by city worker to free unmanaged assets like records, database associations and so forth.

The arrange() technique has a place with IDisposable interface though finish() strategy has a place the Object class.

21) What is the distinction between strategy over-burdening and technique superseding in C#? 

Technique parameters must be distinctive in strategy over-burdening though it must be same in technique superseding.

Legacy isn't required in strategy over-burdening, it happens inside a similar class. Be that as it may, legacy is required in technique abrogating.

22) What is object pool in .Net? 

Item pool is a compartment of prepared to utilize objects. It diminishes the overhead of making new item.

23) What is delegate in C#? 

A representative in C# is an article that holds the reference to a strategy. It resembles work pointer in C++.

24) What is Hashtable? 

A Hashtable is an accumulation of key/esteem sets. It contains values dependent on the key.

25) What is Reflection? 

Reflection enables us to get metadata and congregations of an article at runtime.

26) What is Garbage Collection? 

Refuse Collection is a procedure of discharging memory naturally involved by articles which are never again open.