• Home »
  • .Net »
  • DOT NET Interview Questions and answers for experienced

DOT NET Interview Questions and answers for experienced

Question.1   What are the benefits of .NET Framework?


.NET Framework offers many benefits to application developers. Some of these benefits are as follows:

Consistent programming model —.NET Framework provides a consistent object-oriented programming model across various languages. You on we this model to create programs for performing different tasks, such as connecting to and retrieving data from databases and reading from and writing to files.

Language interoperability —Language interoperability is a feature that enables a piece of code written in one language to be used in another language. This facilities the reuse of code and therefore improves the efficiency of the development process.

Automatic management of resources —Wink developing .NET. applications, you may use various resources, such as files, memory, and database connecters. With MET Framework, you do not need to manually free these resources when they are no longer required.

Ease of deployment- .NET framework makes the deployment of applications easier. To install an application that is not based on NET Framework you need to copy It and its components on target computers. However, with MET Framework, you can quickly Install or deploy the applications such that Installation of new applications or components does not affect the existing applications.

Question.2   Mention the core components of .NET Framework.


The two core components of .NET Framework are:

 Common Language Runtime

 .NET Framework Class Library.

Question.3   Briefly describe MSIL.

Answer:   .NET Framework is shipped with compilers of all Programming languages to develop Programs. There are separate compilers for the Visual Basic, CS, and Visual C++ programming Languages in .NET  Framework Each .NET compiler produces an intermediate aide after Compiling the source code. The Intermediate code is common for all languages and Is understandable only to NET environment. This intermediate code IS known as MSIL.  MSIL file Is an executable file that can be transferred across various machines.

Question.4   Briefly describe the roles of CLR in .NET Framework.

Answer:    CLR provides an environment to execute MET applications on target machines.

CLR-is also a common runtime environment for all MET code irrespective of their programming language, because the compilers of MET Framework convert every source code into a common language known as MSIL .

 CLR also provides various services to execute processes, such as memory management service and security services..CLR performs various tasks to manage the execution process of MET applications. The responsibilities of as are listed below:

Automatic memory management–CLR invokes venous built-in functions of MET Framework to allocate and de-allocate the memory of MET objects. Therefore, programmers need not write the code to explicitly allocate and de-allocate memory to programs.

Garbage Collection —Garbage collection Is the major role of CUR, with prevents memory leaks during execution of programs. The Garbage collector of CLR automatically determines the best time to free the memory, which is reserved by an object for execution.

Code Access Security —Code Access Security (CAS) model is used in MET Framework to impose restrictions and security during execution of programs. CLR uses security objects to manage access to code during execution of MET applications. as allows an executing code to perform only those tasks for which it has permission.

Question. 5  What is the role of the /IT compiler In .NET Framework?

Answer:   The MT compiler is an important element of as, with loads 14.511 on target machine for execution. The MSIL is stored in MET assemblies after the developer has compiled the code written in any .NET.  compliant programming language, such as Visual Basic and C#.

Question.6   What is CTS?

Answer:   CTS is the component of CUL through which WET Framework provides support for multiple languages because it contains a type system that is common across ate languages. Two CIS-compliant languages do not require type conversion when calling the cede written in one language from within the code written in another language. CTS provides a base set of data types for al the languages supported by.NET Framework. This means that the size of integer and long variables is the Same across ah .NET compliant programming languages. However, each language uses aliases for the base data types provided by CTS. For example, CTS uses the data type system. Int32 to represent a 4 byte integer value; however, Visual Basic uses the alias Integer for the same, whereas Cl uses the alias int. This is done for the sake of clarity and simplicity.

Question.7   What Is CLS?

Answer: Common Language Specification (CLS) is a set of basic rules, which enables interoperability between two .NET-complaint languages. CIS is a subset of CTS; therefore, the languages supported by CLS can use each other’s c lass libraries similar to their own. Application programming interfaces (APIS), which we designed by following the rules defined In CLS, can be used by W .NET-compliant languages.

Question.8  What Is managed code?

Answer:   Managed code is the code that Is executed directly by the CLR. The applications created by using managed code automatically have CLR services such as type Checking, security, and automatic garbage collection. These services Help provide platform and language independence for managed code applications. The CLR compiles the source code to MSIL, not machine code. This MSIL along with the metadata that describes the attributes, classes and methods of the code resides an assembly.

Question.9  What is an assembly?

Answer:  An assembly is the primary building block of .NET Framework applications. In .NET, every application is compiled into an assembly, which refers to a portable  executable (PE) file. The PE file can be either a dynamic Link library of an executable (.exe file).that contains the MSIL code of the compiled application. In addition to the MS11, an assembly also contains the files and resources necessary for the application, assembly metadata, and’ type metadata. An assembly stores the information about itself  such as the name, version number of the assembly, and security information, which Is called metadata. Ibis also o ceded the assembly metadata. The type metadata is the information about the types (classes, structures, interfaces, and enumerations) required for the assembly.

Question.10  Explain the different types of assemblies.

Answer:   Assemblies are of two types, private and shared assemblies. A private assembly is used by the clients of the same application directory structure as the assembly. A shared assembly is stored in the global assembly cache (GAC), which is a repository of assemblies maintained by the runtime. A Shared assembly can be referenced by more than one application.

Question.11  Can one DLL file contains the compiled code of more than one .NET language?

Answer:   No, a DLL file can contain the complied code of only one programming language.

Question.12   What Is the maximum number of classes that can be contained In one DLL file?

Answer:   There is no limit to the number of classes that can be curtained In a DLL file.

Question.13   Explain the differences between managed and unmanaged code?

Answer:   Managed code is the code that is executed chatty by the QR Instead of the operating system. Unmanaged code is the code that is executed directly by the operating system outside the OR environment. In managed code, since the execution of the code Is governed by CLR, the runtime provides different services  such as garbage collection, type checking, exception handling, and safety  and support These sat help provide uniformly in platform and language-Independent behavior of managed code applications. In unmanaged code, the allocation of memory, type safety, and security  is required to be taken are of by the developer. If the unmanaged code is not Properly handles, may result In memory leak. Examples of unmanaged code are ActiveX components and Wm32 AM that execute beyond the scope of native CLR.

Question.14    Mention the execution process for managed code.


A piece of managed code is executed as follows:

 1. Chasing a language compiler

2. Compiling the code to MSIL

3. Compiling MSIL to native code

I. Creating the code

Question.15  Difference between int and int32?

Answer:   Both are the same. system. int32 is a .NET class and int is an alias name for System. Int32.

Question.16   What is side-by-side execution? Can two applications, one using a private assembly and other using a shared assembly, be stated as side-by-side executables?

Answer:   Side-by-side execution Is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the CLR and multiple versions of applications and components Mat use a version of the runtime on the same computer at the same time. As versioning is only applied to shared assemblies and not to private assemblies, two applications, one using a private assembly and other using a shared assembly, cannot be stated as side-by-side executables.

Question.17   Why Is string called Immutable data type?

Answer:   A sting represents text and stores a sequential collection of characters in the memory. A string object is said to be immutable (read only), because a value once assigned to a string object cannot be changed after the acting object has been created. When the value In the string object is modified, a new string object is created with a new value assigned to the string object therefore, keeping the old string In memory for garbage collector to be disposed.

Question.18  What is code access security?

Answer:  Code access security (CAS) is part of the .NET security mode that determines whether or not a piece of code is allowed to run and what resources it can use while running.

Question.19 What are the advantages of ASP.NET MVC?


1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.

2. Complex applications can be easily managed

3. Separation of concerns. Different aspects of the application can be divided into Model, View and Controller.

4. ASP.NET MVC views are light weight, as they do not use viewstate

Visit for DOT NET e-learning