This article contains common .NET interview questions and answers that can help you land the position and test your knowledge of the framework.
Answer: It is a software framework developed by Microsoft, which is used to create and run a wide range of software applications on windows. It supports various languages like C#, VB, Cobol, Perl, .NET, etc. With the help of. NET developers can work on both form- and web-based applications and services. The wide variety of tools and functions such as class, libraries, and APIs help build, deploy, and run different applications and web services.
Answer: The two most essential components of the .NET framework is the Common Language Runtime(CLR) and Class library.
Some Other components are Common language runtime, .Net Class library, Application domain, Common Type System, .Net framework, Profiling, etc.
CLR provides various building tools and resources that help the developers set the foundation of building an application.
The class library holds essential classes that provide commonly known functionality that is shareable across applications.
Answer: The reason behind the .net framework to be multilingual is that its compilers convert the source code into Microsoft Intermediate Language (MSIL). The code is compiled from IL and is interoperable with the code from another language. So after compilation, the language doesn’t remain a barrier, and the code can also call or use functions of another language.
Answer: Managed code: the codes whose execution is managed by Common Language Runtime. It receives the managed code and compiles it into the machine code that is then executed. This code runs inside the car, so it becomes mandatory to install the .Net framework to implement the managed code.CLR manages the memory through garbage collection and uses some other features like CAS and CTS to execute it efficiently.
Unmanaged code: those applications which are not under the control of CLR are known as unmanaged code. They use pointer variables at the time of execution. This means it is developed by any other language independent of the .Net framework. It uses its runtime environment for compiling and execution. In this, the developers manage the type of safety, memory allocation, security, etc. Several problems related to memory occur, like buffer overflow, memory leak, pointer override, etc., that arise due to this reason.
Answer: Code access security is Microsoft’s solution to prevent untrusted codes from performing privileged actions. By this mechanism, common language runtime (CLR) restricts the managed code to execute operations with a limited set of permissions. It uses evidence to help get the right permissions to the right Assembly. It provides evidence-based security built on a layer above the protection provided by Windows.
Answer: Response. Redirect transfers the request to a new URL and specifies the unique URL. It redirects the user’s browser to another page or site. It forces the client to navigate to the pages they are Redirected to. In HTTP terms, it sends a 302 response to the client.
Server. Transfer transfers the receiver from one page to another, terminates the current page’s execution, and initiates a new page’s performance by using the specified URL of that page. It reduces the server requests by keeping the URLs the same. In this, the browser knows nothing about the process.
Answer: an assembly is a collection of Logic units. This logic unit contains different types and resources to work together to build an application and deploy them using the. Net framework. The CLR uses this information and works over it.
.Net framework supports three kinds of assemblies:
Answer: It manages the allocation and release of memory for your application. This helps in automatic memory management. The unused code objects in the memory get freed by this process.
The memory heap in the Garbage collector is divided into three generations.
Garbage collection of generation 2 means it has collected the whole garbage of all the generations, i.e., generation 2 and generation 0 and generation 1.
In this process, the first phase works in the identification of live objects.
In the second phase, the objects which will be compacted get their references updated.
In the third and last phase, the reclamation of space occupied by dead objects is done.
Answer: Function
stored procedure
Answer: caching means to store data temporarily in the memory so that instead of searching for the data in its original location, one can easily access it from memory. It increases the speed as well as the efficiency of the application.
There are mainly three types of caching.