Dot Net Interview Questions

Interview Questions

There are a lot of components that make up the .NET framework, and some of them are as follows:

  • .NET Class Library
  • .NET Framework
  • Language Runtime
  • Application Domain
  • Profiling

JIT is the abbreviation of Just in Time. It is a compiler that is used to convert intermediate code into native code easily.

In .NET, during execution, the code is converted into the native language, also called the byte code. This is processed by the CPU, and the framework helps with the conversion.

MSIL is the abbreviation for Microsoft Intermediate Language. It is used to provide the instructions required for operations such as memory handling, exception handling, and more. It can also provide instructions to initialize and store values and methods easily.

The next .NET interview question involves an important concept.

The acronym CTS stands for Common Type System, which encompasses a predefined set of systematic regulations dictating the proper definition of data types in relation to the values provided by a user. Its primary purpose is to characterize and encompass all the various data types utilized within a user’s application.

Nevertheless, it is also permissible for users to construct custom calls using the guidelines established by the CTS. This feature is primarily provided to accommodate the diverse range of programming languages that can be employed when working within the .NET framework.

CLR stands for Common Language Runtime. It forms to be the most vital component of .NET as it provides the foundation for many applications to run on.

If a user writes an application in C#, it gets compiled and converted to intermediate code. After this, CLR takes up the code and works on it with respect to the following aspects:

  • Memory management
  • Security protocols
  • Libraries for loading
  • Thread management

Managed Code Unmanaged Code
Managed by CLR Not managed by any entity
Garbage collection is used to manage memory Runtime environment takes care of the management
The .NET framework is necessary for the execution N

ot dependant on the .NET framework to run

There are four main steps that include in the execution of the managed code. They are as follows:

  1. Choosing a compiler that can execute the code written by a user
  2. Conversion of the code into Intermediate Language (IL) using a compiler
  3. IL gets pushed to CLR, which converts it into native code using JIT
  4. Native code is now executed using the .NET runtime

State management, as the name suggests, is used to constantly monitor and maintain the state of objects in the runtime. A web page or a controller is considered to be an object.

There are two types of state management:

  • Client-side: It is used to store information on the client’s machine and is formed mostly of reusable and simple objects.
  • Server-side: It stores the information on the server and makes it easier to manage and preserve the information on the server.

 

Object Class
An instance of a class The template for creating an object
A class becomes an object after instantiation The basic scaffolding of an object
Used to access properties from a class The description of methods and properties

system.stringbuilder system.string
Mutable Immutable
Supports using append Cannot use the append keyword

LINQ is the abbreviated form of Language Integrated Query. It was first brought out in 2008, and it provides users with a lot of extra features when working with the .NET framework. One highlight is that it allows the users to manipulate data without any dependency on its source.

An assembly is the simple collection of all of the logical units present. Logical units are entities that are required to build an application and later deploy the same using the .NET framework. It can be considered as a collection of executables and DLL files.

There are four main components of an assembly. They are as follows:

  1. Resource: A collection of related files
  2. MSIL: The Intermediate Language code
  3. Metadata: The binary data of a program
  4. Manifest: A collection of information about the assembly
  5. What is the meaning of caching?

Caching is a term used when the data has to be temporarily stored in the memory so that an application can access it quickly rather than looking for it in a hard drive. This speeds up the execution to an exponential pace and helps massively in terms of performance.

There are three types of caching:

  • Data caching
  • Page caching
  • Fragment caching

The next .NET interview question we will check involves an important concept.

Function Stored Procedure
Can only return one value Can return any number of values
No support for exception handling using try-catch blocks Supports the usage of try-catch blocks for exception handling
The argument consists of only one input parameter Both input and output parameters are present
A function can be called from a stored procedure The stored procedure cannot be called from a function

There are five main types of constructor classes in C# as listed below:

  • Copy constructor
  • Default constructor
  • Parameterized constructor
  • Private constructor
  • Static constructor

There are numerous advantages of making use of a session are as mentioned below:

  • It is used to store user data across the span of an application.
  • It is very easy to implement and store any sort of object in the program.
  • Individual entities of user data can be stored separately if required.
  • The session is secure, and objects get stored on the runtime server.

Manifest is mainly used to store the metadata of the assembly. It contains a variety of metadata which is required for many things as given below:

  • Assembly version information
  • Security identification
  • Scope checking of the assembly
  • Reference validation of classes

Memory-mapped files in .NET are used to instantiate the contents of a logical file into the address of the application. This helps a user run processes simultaneously on a single machine and have the data shared between processes.

The MemoryMappedFile.CreateFromFiles() function is used to obtain a memory-mapped file object easily.

CAS stands for Code Access Security. It is vital in the prevention of unauthorized access to programs and resources in the runtime. It can provide limited access to the code to perform only certain operations rather than providing all at a given point in time. CAS forms to be a part of the native .NET security architecture.

Scroll to Top