C#.NET Interview Question for Senior and Junior Developers-Part 1/2

Here are top C# interview questions and answers which are common on almost all .NET interview. These C# interview questions are for both beginners and professional C# developers.

C# interview Question : 1

What is .NET Framework ?

.NET framework is developed by Microsoft which provides an environment to run, debug and deploy code onto web services and applications by using tools and functionalities like libraries, classes, and APIs.

C# interview Question : 2

What is difference between .Net and C#?

  • .Net is a Framework, it consists of collection of libraries, assemblies, compilers, runtimes etc. It helps to execute the application
  • C# is a programming Language, it has syntaxes and semantics, it is type safe, case sensitive superhero language.it invokes .Net framework libraries

C# interview Question : 3

 What is difference between .Net and .Net Core and. Net5.0?

  • .Net is a platform dependent, means can work only on Windows Operating System.
  • .Net Core is a platform independent and can work on Linux, mac and performance is very high as assemblies are broken down to small.
  • .Net 5 is a unified approach of .net core .net mono etc.

C# interview Question : 4

 What is BCL?

        Base class library is the core set of basic and fundamental types like String, Datetime etc., that form basic API of CLR

C# interview Question : 5

What are types of Assemblies in .net?

  • Private Assembly
  • Shared Assembly
  • Satellite assembly

C# interview Question : 6

What are the Components of an assembly?

  • Assembly Manifest (which contain assembly metadata)
  • Type Metadata
  • MSIL
  • Resources

C# interview Question : 7

 What is CLR?

  • Common Language Runtime is a virtual machine component from .net it is a runtime environment.
  • It is responsible for running .net applications written in any .net languages. by converting managed code to non-managed code (machine code)

C# interview Question : 8

 What is Marshalling?

         It is the process of creating a bridge between managed code and unmanaged code.it helps in interaction between both .it is done by CLR.

C# interview Question : 9

 What are components of CLR

     Main components of CLR:

  • Common Language Specification (CLS)
  • Common Type System (CTS)
  • Garbage Collection (GC)
  • Just In – Time Compiler (JIT)

C# interview Question : 10

 What is CLS?

 Common Language Specification is responsible for helping CLR to understand different .net programming languages by providing syntax and regulation of different languages

C# interview Question : 11

 What is CTS?

      Commons Type System, Every Language has its own datatypes, CLS help the CLR by understanding all these datatypes and convert them to CLR understandable format

C# interview Question : 12

 What is Garbage Collection (GC)?

                  Garbage collection is process of claims unused memory of managed resources. It runs as a background process and only removes runtime unused resources.

                  It cannot collect unused memory of unmanaged codes

                  It can be manually triggered using System.GC.Collect

C# interview Question : 13

  What is IL?

                      Intermediate language or MSIL (Microsoft Intermediate Language) is an object-oriented programing language which .net compilers compiles our code to before converting it to machine code.

C# interview Question : 14

 Why is it important for complier to compile to IL Code?

                      The development environment may be different from runtime environment.

e.g. developing machine may be windows 10 and runtime environment may be windows XP, so a language-specific compiler converts the source code to the intermediate language. This intermediate language is then converted into the machine code by the Just-In-Time (JIT) compiler.

Then JIT will convert the IL code to optimal code for runtime environment.

C# interview Question : 15

 What is JIT?

           Just in Time compiler is a part of Common language runtime (CLR) it converts the IL code to Machine code which is best fit for the machine running JIT .

C# interview Question : 16

 What is Stack & Heap in .net?

             Stack & Heaps are memory allocations in .net both stored in RAM.

  • Stack is a static memory allocation, it stores the primary datatypes variables, variables with the name(pointer) and value are stored together, making it faster, it follows LIFO to free resources, e.g. last allocated resource will be cleared first, Use it when you know exact size of variable.

                           e.g. int a=5; the variable a and its value 5 is stored in same location.

  • Heap is a dynamic memory allocation, it is mostly used for object types, the variable (variable is stored on stack and the values are stored on Heap, in the stack variable point to the address of heap), use it when the size is initially not known.
  • What is Value type in .net?

                    Value types datatype stores it content in the memory allocated on Stack, means when a value type variable is created single space in memory is allocated to store the value and variable. It is independent memory allocation.

C# interview Question : 17

What is Value type in .net?

      Value types datatype stores it content in the memory allocated on Stack, means when a value type variable is created single space in memory is allocated to store the value and variable. It is independent memory allocation.

C# interview Question : 18

What happens when you assign one value type to another new variable?

                    When one value type variable is assigned to another variable, a new independent memory is allocated within stack for new variable.

 e.g.  int k=5;

         int j=k;

Both above k&j are independent memory, any change made in one will not affect other on runtime.

C# interview Question : 19

 What is Reference type variables in .net?

                              Reference type doesn’t store it values directly, instead it stores the address where is value is stored, i.e. reference type contains the pointer to another memory location that holds the data.

C# interview Question : 20

What is Boxing?

  Boxing is the process of converting a value type to reference type.

                 e.g. int k=5;

                        Object p=k;

C# interview Question : 21

What is Unboxing?

  Unboxing is the process of converting a reference type to value type.           

              e.g. Object p=5;

                      int k=(int)p;

C# interview Question : 22

What is Casting?

           Converting a variable from one type to another is called casting.

C# interview Question : 23

What is Implicit Casting?

            Simple casting where no extra code is required like casting from integer to double (mostly from low datatype to high)

                                 e.g. int k=5;

                                       double p=k;         

C# interview Question : 24

What is Explicit Casting?

               Casting where extra code is required to convert a variable from one type to another (mostly in case of high datatype to low (there may a data loss)

                                 e.g. double k=1.5;

                                         int p=(int) k;

C# interview Question : 25

What is GAC?

Global Assembly Cache is a place where .net saves the assemblies specially designed to be shared to multiple applications, e.g. software dlls, crystal report dll etc are stored in GAC

Show All Cards



Commented by : {{x.userName}} {{new Date( x.addedDate).toString().split(' ').splice(0, 5).join(' ') }}


Other Free Training Materials Available

Free Kerala PSC Exam Training Online
Way4job - Free Kerala PSC training online with previous question papers and free mock exams

Free Kerala PSC training provide notes, Free Online daily Mock test, Previous Questions and answers in english and malayalam. Practice previous years question answers in exam mode will help you success.

Study Now
Free DHA Training
Free DHA Training for Nurses ,Doctors and other medical persons. Sample Questions and Mock test

Study and Practise DHA

Study Now
Free Online PMP Training based on PMBOK
Best Free Online PMP Training based on PMBOK

Best Free Online PMP Training based on PMBOK and PMI guidelines,Sample questions,Exam Simulators and PMP Notes and Flashcards makes you understand the concepts clearly and pass PMP exam at first attempt

Study Now
Free Microsoft Certification Trainings Material
Free Microsoft Training

Study Now
Currently viewing : 565