Dot net framework Interview Questions

Are you tensed about what you need to do to crack your next Dot NET Framework job interview by answering the tricky Dot NET Framework questions? Not anymore! We are aware of these tricky interview scenarios and that is why our group of experts, as well as former interviewers, have come up with a set of 14 Dot NET Framework interview questions and answers to give you that edge over others to successfully crack you next Dot NET Framework interview.

  • 4.7 Rating
  • 13 Question(s)
  • 15 Mins of Read
  • 7651 Reader(s)


The code that can be compiled into an intermediate language so we cannot run it directly on the computer as of native code.  Managed code runs in the Common Language Runtime.

Key features of managed code are:

  • Managed code increases the performance gain of the application as well as it doesn`t require extra security feature while using unmanaged code we require extra security to increase the performance of the application
  • It includes the garbage collection and scalability feature which is the lifetime control of object
  • It makes the deployment easy and improves the version facilities at the end of dll.
  • It provides Built-in security by using code access security and avoiding buffer overruns.

Managed code runs entirely "inside the sandbox," meaning that it cannot make calls outside of the .NET Framework.  To perform more safely and efficiently we use managed code to get the maximum benefit from the features of the .NET Framework.

Code in VB.NET and Cis the managed code. If you're working with those applications, you are making managed code. We can use managed code using c++ according to the choice of the user.

A .NET programming language like C#, VB.NET etc., not directly compiled into executable code; instead, they compile into an intermediate code called Microsoft Intermediate Language (MSIL). Since it automatically converts to MSI, so the programmer doesn’t need to be worried about that.

MSIL is similar to Java Byte code. A Java program is compiled into Java Byte code (the .class file) by a Java compiler, the class file is then sent to JVM which converts it into the host machine language.

Along with the Microsoft Intermediate Language MSIL the compiler also produces the MetaData which are contained in the portable executable PE file when the compiler produces MSIL it provides some instruction like  loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations

 Advantages -

  • MSIL provides language interoperability as code is written in any .net language is compiled into MSIL.
  • Same performance for all .net languages
  • It provides support to different runtime environments
  • JIT compiler in CLR converts MSIL code into native machine code which is executed by OS

JIT (JUST-IN-TIME) is a Compiler before MSIL be executed, it first converted to native code by .NET framework Just In Time(JIT) compiler, which runs on the same System on which the JIT Compiler is executing.

Just-in-time (JIT) is a term that is used to describe any action like compilation or object activation that only happens when it is necessary. This term is associated mostly with software compilation. It is designed because it has features to be accessed on multiple platforms and it also has high speed.

In Microsoft .NET there are three types of JIT (Just-In-Time) compilers :

  • Pre-JIT Compiler: It compiles complete source code into native code in a single compilation cycle. It converts the .NET code from platform independent state to platform-specific stage.
  • Econo JIT Compiler: It compiles only those methods that call at runtime and once these compiles methods are not in use are removed. Econo JIT spends less time compiling so startup latency is lower for interactive applications.
  • Normal JIT Compiler: It compiles only those methods that are called at runtime, and after the execution of these methods is stored in memory, it is commonly referred to as “Jitted”. Methods that are compiled once are not compiled again.

All windows executable files and assemblies follow the Portable executable file formats.

.NET PE file format consists of four parts:

  1. PE/COFF Headers: it contains information regarding exe or dll files.
  2. CLR Header: contains information about CLR, memory management and CLR other related stuff.
  3. CLR Data: Contains metadata of ddls and MSIL code generated by compilers.
  4. Native image section: contains native image section like .data, .rdata, .rsrc, .text etc

All .NET assemblies are built over the PE file formats, that is used for all exes and dlls, which itself are built over the MS-DOS executable file formats.

Most of PE files are split up into separate sections, where each section stores different types of data. Like: .text stores all executable code, .rsrc store unmanaged resources, .debug stores debugging information, .data section stores the global variables..etc.,.

A PE file has headers and sections that tell the dynamic linker about how to map file into memory. The task of the dynamic linker is to map each section of the memory and assign the correct permissions to the resulting regions, according to the instructions found in the headers

In a .NET framework executable, the PE code section is having a stub that invokes the CLR virtual machine startup entry, _CorExeMain or _CorDllMain in mscoree.dll, which is much the same as in Visual Basic executables.

The development on this platform intends to be binary compatible with Microsoft .NET, it uses the same PE format as the Microsoft implementation.

Microsoft .NET Framework application is a primary unit for deployment in Asp.Net.It provides all required execution information to common language runtime so It is called as the building block of an application.

In .NET, there are two kinds of assemblies,

  1. Single file
  2. Multi file.

An assembly that contains all information like IL, Metadata, and Manifest  in a single package is called as single file assembly. Most of the assemblies in .NET are build up as a single file assemblies.

Multiple file assemblies contain the multiple .NET binaries which are generated for bigger applications. In this, there will always be one assembly which will contain a manifest and while others will have IL and Metadata instructions.

Assembly has the code that the common language runtime(CLR) executes. Microsoft intermediate language (MSIL) code will not be executed the portable executable (PE) file if it does not have an associated assembly manifest.

It resides in each and every type’s identity which includes the name of the assembly. A type which is called MyType is loaded in the scope of one assembly and it is not the same as the type which is called MyType which is loaded in the scope of another assembly.

Assemblies can be of static or dynamic type. Static assemblies are those which include .NET Framework types (interfaces and classes), also if it is having the resources for the assembly (bitmaps, JPEG files, resource files, and so on). it is stored on disk in portable executable (PE) files. We can also create dynamic assemblies using a .NET framework, which can run directly from memory and will not save in the disk before execution. You can save dynamic assemblies to disk after their execution.

There are two kinds of assemblies in .NET;

  1. Private
  2. Shared

Private assemblies are very simple as they can be easily called upon each time from the assembly folder.

Shared assemblies known as a strongly named assembly are copied at a single location (usually GAC). For applications that are using the same assemblies, the same copy of shared assemblies are called from its original location, and hence they are not copied to each applications private folder. Each shared assembly has the four part name which includes its face name, version, public key token and culture information.

GAC stands for Global Assembly Cache.

- It reserves an area for .NET Application to store the assemblies in the memory running on a certain machine.

- It helps in sharing the assemblies to all .NET application.

- To install in GAC, assemblies must have a strong name and must be publicly shared.

- by using Graphical User interface and the command line tool we can work with a cache by installing the CLR which has the global assembly cache and the one with windows shell extensions this is called as Global Assembly Cache tool (Gacutil.exe).

-The .NET Framework provides two tools for working with cache

When we want to share the assembly to the whole application then we use GAC which is stored in the folder of windows directory The concept of GAC is the result of the .NET architecture whose design addresses the issue of "DLL hell" that existed in COM (Component Object Model). In .Net there is no need to register the assembly before taking it in use. We can easily access it globally since it will not conflict by identifying its name, version, architecture, culture and public key

It has a certain feature of a shared library where different users can use the file which is stored in a common folder. In .NET 4.0, its default location is: %windir%\Microsoft.NET\assembly

There are two tools related to GAC are:

  1. GAC Tool (gacutil.exe): It is used to check for assembly existence, to register the shared assembly and to view and manipulate GAC contents.
  2. Assembly Cache Viewer (shfusion.dll): It helps in displaying the details like version, culture etc. with the assemblies which are associated with it in the cache.

Dispose: - Dispose helps to release the object resources from the object and not access them again. It basically helps in external memory clean uses the Dispose() method to free up all its expensive resources and making it for reuse, and IDisposable interface is used which decides where and how Dispose() is used.

Finalize :- If Dispose is not called then Finalize() method is called for the cleanup, when we don’t want to clean up the memory immediately and want to de-allocating the memory later we use Finalization. If Dispose does not call, then garbage collector uses the finalize() method.

It is used to free unmanaged items like file or Database connection
It can be used to free unmanaged items like files, database connections etc. held by an object before that object is destroyed
It belongs to IDisposable interface
It belongs to Object class
Called from user code and the class which is implementing dispose method
Only called by Garbage Collector and not by user code

The .NET application is said to be multilingual because we can deploy it in different language, the language it supports are visual basics, .NET, C#, J# which compiled to a command Intermediate language the Java byte code which is developed by Microsoft is a low-level language with simple syntax which is easily be translated into native machine code


CLR helps .NET framework to be multilingual, the code running under CLR is termed as managed code, the main task of CLR is to convert compiled code into native code, it has different compilers some of them are

VB .NET, C#, C++, JScript or any third party compiler such as COBOL.

It simply means that you can create pages in different languages (like C#, VB .NET, J# etc.) and once all of these pages are compiled they all can be used in a single application


CTS is Common Type System it is used when we are using the managing types, it is basically used to handle the data types. .NET have many languages and each language is having many other data types one language data types cannot be used in other languages, so in that case, we use the CTS

Example: we have the application in C# which is having the data type of int and there is another data type of integer in VB.NET, them CTS helps in converting the integer into the int32 structure.


It is Common Language Specification, it has developed certain rules which everyone used to follow like if we have created the code for the multiple inheritances in C++ and if use that code in c# and it will not compile since multiple inheritance is not allowed in C# also it makes C# a case sensitive members of the same class cannot have the same name like Add() and add() they consider as different function.

When we want to record the unusual activity during runtime, .net takes the help of the trace by following the page execution path which displays the information at run time

There are 2 levels of tracing used in .NET

1)    Page Level Tracing

2)    Application level Tracing

Page Level Tracing: it is for managing the trace of the page whether it is enabled or disabled, if it is enabled then a page which is requested, it appends to the page a series of tables containing the details of page request during execution

In this there are 2 Trace Modes:

1) SortByCategory: In this, it sort trace message according to the categories

2) SortByTime: In this, it sorts the message according to the order in which they are processed.

Application Level tracing: In this, we can set the trace for the whole application at once instead of setting for individual page, it is useful when we want to trace for the whole application instead of enabling and disabling for an individual page

We can trace the information according to the request limit we have to specify the default number is 10, as soon as it reaches the request limit it stops tracing.


It is a platform which is developed by Microsoft for the software development. In the current scenario, the version used by the programmer is 4.7.1.

It is very effective when we want to create - Form-based and Web-based applications. Web services using the development tool, .Net framework.

It is multilingual in terms of a programming language. It uses C# or Visual Basic to develop the application, in this user can make its own choice by choosing its own language to develop the application

.Net Framework Architecture :

1. Language :

  • WinForms – This is used for developing Windows Forms applications, which runs on an end user machine. Example: Notepad.
  • ASP.Net – This is used for developing web applications which runs on browsers such as Internet Explorer, Chrome or Firefox
  • ADO.Net – This is used to develop applications that interact with Databases such as Oracle or Microsoft SQL Server

2. Class Library: .Net Framework included a number of class libraries which contain the method and function which helps in handling the file level operation. For example, a class library that has methods to handle all file-level operations like a method which can be used to read the text from a file

3. Common Language Runtime: Common Language Infrastructure has the following key features:

  • Exception Handling: Exceptions are errors which occur when the application is if you are opening the file from the local which is not present at the local then it will give an exception
  • Garbage Collection: when we wanted to remove the unwanted resources from the code which is no longer in use can be done by the garbage collector.

Like as the database connection in the application which is no longer in use when compilation stops

Common Language Runtime. It works as an interface between an Operating Systems and the applications which are developed using the .NET framework. The main objective of CLR is to execute the program by converting the managed code to native code. CLR 's Just In Time (JIT) compilation converts Intermediate Language (MSIL) to native code at application run time.

When .Net application is executed, then the control goes to Operating System, which creates a process to load CLR

CLR services

  • Assembly Resolver
  • Assembly Loader
  • Type Checker
  • COM marshaller
  • Debug Manager
  • Thread Support
  • IL to Native compiler
  • Exception Manager
  • Garbage Collector

Assembly Resolve

It will send the request to the assembly loader by identifying assembly whether it is private or shared assembly.

Assembly Loader

According to the assembly resolver instruction, the assembly loader loads the instruction into the application.

Type Checker

To provide the safety checker helps in verifying the types which are used in the application with CTS or CLS

COM marshaller

It helps in getting communicating with the COM components which supports the COM interoperability.

Debug Manager

Using this we can check the code by line by line according to that we can make the changes in the code without terminating the application execution.

Thread Support

It manages more than one execution path in the application process, this provides multithreading support.

IL to Native compiler

Just In Time (JIT) compiler is used to convert the IL code to native code.

Exception Manager

It will handle exceptions thrown by application by executing catch block provided by exception, if there is no catch block, it will terminate the application.

Garbage Collector

when we wanted to remove the unwanted resources from the code which is no longer in use can be done by the garbage collector.

Like as the database connection in the application which is no longer in use when compilation stops.

CLS stands for Common Language Specification as the name suggests it set of certain feature which is very helpful for library and compiler writers if any other language that supports CLS can be used fully in each other's language, thus we can say that CLS is a subset of the common type system.

It is actually a set of restrictions on the CTS. It not only defines the types allowed in external calls, but also the rules for using them, depending on the goal of the user.

CLS is basically a subset of the entire set of features supported by CLR. With CLS, we can call virtual methods or can overload methods and not include things such as unsigned types.

It defines a common level of language functionality. CLR is the set of rules that a language compiler must follow while creating a .NET application at run in CLR. Anyone who wants to write a .NET·-compliant compiler needs simply to adhere to these rules and that's it.CLS is a set of rules through which we can exchange information over a single platform. The beauty of this is that the restriction to use features only applies to public and protected members of classes public classes. Within the private methods of your classes, any non-CLS code can be written, because the code in other assemblies cannot access this part of your code

The Common Type System defines how types are declared, used, and managed in the common language runtime, and is also an important part of the runtime's support for cross-language integration.

Here we have several languages and each and every language has its own data type and 1 language data type cannot be understandable by other languages.

CTS is a specification created by Microsoft and included in the European Computer Manufacturer‘s Association standard. It has certain standard features for implementing the .NET framework.

There are different types which CTS Support:

  1. Value Types: It directly contains the data and instances are either allocated on the stack or allocated inline in a structure. Value types can be built-in, user-defined or enumerations types.
  2. Reference Types: Value’s memory address reference are stored and are allocated on the heap. This can be any of the pointer types, interface types or self-describing types.

Operations on variables of a value type do not affect any other variable, whereas, operations on variables of a reference type can affect the same object referred to by another variable.


Are you tensed about what you need to do to crack your next Dot NET Framework job interview by answering the tricky Dot NET Framework questions? Not anymore! We are aware of these tricky interview scenarios and that is why our group of experts, as well as former interviewers, have come up with a set of 14 Dot NET Framework interview questions and answers to give you that edge over others to successfully crack you next Dot NET Framework interview.