Top 20 C# Interview Questions and Answers

bootstrap format,sql school,interviewing questions,course in data science,python with data science,data science best courses,learning data science,data science basics

Hello friends welcome to MANteck, guys recently some users commenting me to post interviews questions of C# language so i work on it and i found most important questions.

I will also tell you the answers of there questions, which i search and update the answers for your best.

Let's Start...

Most ask C# Interview Questions

1. What is C#?

C # is a computer programming language. C # was developed in 2000 by Microsoft to provide a modern general programming language that can be used to develop all kinds of software for different platforms, including Windows, Web and Mobile, using a single programming language.
C # is the primary language for creating Microsoft .NET software applications.

2. What is Managed and Unmanaged Code?

Managed Code

It is the code that is developed using the .NET Framework and supported programming languages ​​such as C # or VB.NET. 
Managed code is executed directly from the Common Language Runtime (CLR or Runtime) and Runtime manages its lifecycle, including object creation, memory allocation and disposal of objects. Any language written in the .NET Framework becomes managed code.

Unmanaged Code

The code developed outside of the .NET framework which unmanaged code.

It is claimed that applications that are not under the control of the CLR are not handled. Languages ​​like C or C ++ or Visual Basic are not managed.

3. What is the difference between void, static and public?

The variables or methods declared public are accessible anywhere in the application. Static declared variables or methods are accessible globally without setting the class immediately.
Void is a type of modifier that says that the method or variable return no value.

4. Define Constructor

A Constructor is a member function in a class that has the same name as its class. The constructor is automatically called up every time an object class is created. Compile values ​​of data members during class initialization.

5. What is Jagged Array?

The array that contains elements of array type is called a Jagged array. Elements can be of different dimensions and sizes. We can also say knurled Jagged as an array with arrays.

6. What is the use of 'using' statement in C#?

The block 'using' is used to obtain and process a resource and is then automatically disposed of after completion of the execution of the block.

7. What are sealed classes in C#?

When we want to inherit the class, we create sealed classes. Sealed modifiers are used to prevent derivation from a class. If we strongly specify a sealed class as the base class, a compilation error occurs.

8. What is method overloading?

In many ways the overhead to create a unique signature with the same name and the same degree. During compilation, the compiler used to determine the specific resolution burden.

9. Can a private virtual method can be overridden?

No, because it is not accessible outside the class.

10. What are generics in C#.NET?

Generics are used to create reusable code classes to reduce code redundancy, types of security, and increase work performance. Using generics we can create collection classes. Use the System.Collections.Generic namespace to create a common collection. In the System.Collections namespace instead of classes like ArrayList. The generator promotes the use of types with parameters.

11. What is an object pool in .NET?

An object pool is a container with objects ready to use. It tracks the object that is currently in use, the total number of items in the pool. This reduces the overhead of creating and re-creating objects.

12. What are Custom Exception?

Sometimes there are some errors that need to be controlled according to the needs of the user. They use custom exceptions and are used in defined exceptions.

13. How do you inherit a class into other class in C#?

The colon is used as an inheritance operator in C #. Just put a colon and then the class name.

Public class DerivedClass: BaseClass

14. How can we set the class to be inherit, but prevent the method from bring over-ridden?

Confirm that the class is public and seal the method so that it is not violated.

15. How can we create an array with non-default values?

We can create an array with non-default values ​​using Enumerable.Repeat.

16. What is a multicast delegate?

A delegate to which multiple managers are assigned is called a delegate delegate. Each handler is assigned to a method.

17. What is Console application?

The console application is an application that can be run in Windows at a command prompt. Getting Started .Net is the first step in creating the first step.

18. Can we use "this" command within a static method?

We can not use 'This' in the same way because we can only use the same variables / variables in the static form.

19. What is the difference between constants and read only?

Constant variables are declared and begin at compile time. The value cannot be changed later. Read-only is used only when we want to assign a value at run time.

20. How can we sort the elements of the Array in descending order?

Follow the reverse () method using the sort () methods.


All the 20 questions of C# and there answers are completed.
This 20 questions are most important for interview.

Hope this is helpful for you.