Dot Net Interview Questions | Eklavya Online

Dot Net Interview Questions

ASP .Net is a part of .Net technology and it comprises of CLR too. It is an open-source server-side technology that enables the programmers to build powerful web services, websites and web applications.

ASP stands for Active Server Pages.

MVC stands for Model View Controller. It is an architectural model for building the .Net applications.

Models – Model objects store and retrieve data from the database for an application. They are usually the logical parts of an application that is implemented by the application’s data domain.

View – These are the components that display the view of the application in the form of UI. The view gets the information from the model objects for their display. They have components like buttons, drop boxes, combo box, etc.

Controllers – They handle user interactions. They are responsible for responding to the user inputs, work with the model objects, and pick a view to be rendered to the user.

Response.Output.Write() is used to get the formatted output.

State Management means maintaining the state of the object. The object here refers to a web page/control.

There are two types of State management, Client Side, and Server side.

  • Client-Side – Storing the information in the Page or Client’s System. They are reusable, simple objects.
  • Server Side – Storing the information on the Server. It is easier to maintain the information on the Server rather than depending on the client for preserving the state.

CLS stands for Common Language Specification. With the rules mentioned under CLS, the developers are made to use the components that are inter-language compatible. They are reusable across all the .Net Compliant languages.

An Assembly is a collection of logical units. Logical units refer to the types and resources which are required to build an application and deploy them using the .Net framework. The CLR uses this information for type implementations. Basically, Assembly is a collection of Exe and DLLs. It is portable and executable.

There are two types of Assemblies, Private and Shared.

  • Private Assembly, as the name itself suggests, it is accessible only to the application. It is installed in the installation directory of the application.
  • Shared Assembly can be shared by multiple applications. It is installed in the GAC.

JIT stands for Just In Time. JIT is a compiler that converts Intermediate Language to a Native code.

The code is converted into Native language during execution. Native code is nothing but hardware specifications that can be read by the CPU. The native code can be stored so that it is accessible for subsequent calls.

The different parts of an Assembly includes:

  • Manifest – It contains the information about the version of an assembly. It is also called as assembly metadata.
  • Type Metadata – Binary information of the program.
  • MSIL – Microsoft Intermediate Language code.
  • Resources – List of related files.

MSIL stands for Microsoft Intermediate Language.

MSIL provides instructions for calling methods, initializing and storing values, operations such as memory handling, exception handling and so on. All .Net codes are first compiled to IL.

Following are the types of constructors in C#:

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

Exe and DLLs are Assembly executable modules.

Exe is an executable file. This runs the application for which it is designed. An Exe is generated when we build an application. Hence, the assemblies are loaded directly when we run an Exe. However, an Exe cannot be shared with the other applications.

DLL stands for Dynamic Link Library. It is a library that consists of code that needs to be hidden. The code is encapsulated inside this library. An application can consist of many DLLs. These can be shared with the other applications as well.

Other applications which share this DLL need not worry about the code intricacies as long as it is able to call the function on this DLL.

The code that is managed by the CLR is called Managed code. This code runs inside the CLR. Hence, it is necessary to install the .Net framework in order to execute the managed code. CLR manages the memory through garbage collection and also uses the other features like CAS and CTS for efficient management of the code.

Unmanaged code is any code that does not depend on CLR for execution. It means it is developed by any other language independent of .Net framework. It uses its own runtime environment for compiling and execution.

Though it is not running inside the CLR, the unmanaged code will work properly if all the other parameters are correctly followed.

  • Client-side validation – When the validation takes place on the client-side browser, it is called client-side validation. Usually, JavaScript is used for client-side validation.
  • Server-side validation – When the validation takes place on the server then it is called server-side validation. Server-side validation is considered as a secure form of validation because even if the user bypasses the client-side validation we can still catch it in server-side validation.

Caching means storing data temporarily in the memory so that the application can access the data from the cache instead of looking for its original location. This increases the performance of the application and its speed. System.Runtime.Caching namespace is used for Caching information in .Net.

Given below are the 3 different types of Caching:

  • Page Caching
  • Data Caching
  • Fragment Caching

Follow these steps while executing a Managed code:

  • Choosing a language compiler depending on the language in which the code is written.
  • Converting the above code into Intermediate language by its own compiler.
  • The IL is then targeted to CLR which converts the code into native code with the help of JIT.
  • Execution of Native code.

IL, or Intermediate Language, is a CPU independent partially compiled code. IL code will be compiled to native machine code using current environmental properties by Just-In-Time compiler (JIT). JIT compiler translates the IL code to an assembly code and uses the CPU architecture of the target machine to execute a .NET application. In .NET, IL is called Common Intermediate Language (CIL), and in the early .NET days it was called Microsoft Intermediate Language (MSIL).

CLI, or Common Language Infrastructure, is an open specification developed by Microsoft. It is a compiled code library used for deployment, versioning, and security. In .NET there are two CLI types: process assemblies (EXE) and library assemblies (DLL). CLI assemblies contain code in CIL, and as mentioned, during compilation of CLI programming languages, the source code is translated into CIL code rather than into platform or processor specific object code.

To summarize:

  • When compiled, source code is first translated to IL (in .NET, that is CIL, and previously called MSIL).
  • CIL is then assembled into a bytecode and a CLI assembly is created.
  • Before code execution, CLI code is passed through the runtime’s JIT compiler to generate native machine code.
  • The computer’s processor executes the native machine code.

Answering this question shows you have the basic knowledge and skills required to fulfill the needs of the position. The right candidate should be a knowledgeable programmer who is comfortable coding within the .NET Framework. In addition to telling what languages the framework supports, you can also provide your experience programming within those languages.

Example: “The .NET Framework supports more than 60 languages. This includes both Microsoft and non-Microsoft languages. The most common languages are VB.NET, Cobol, Perl, C#, C++ and F# languages.

I began my programming career by learning C#. It’s provided an important foundation for my professional development as a programmer. When I got my C# programming certificate, I was promoted to a full-time developer at National Telecom Ltd. In that role, I also learned F# and Cobol. This makes me very familiar with these common languages applied to the .NET Framework.”

The main differences between system.stringbuilder and system.string are:

  • system.stringbuilder is a mutable while system.string is immutable.
  • Append keyword is used in system.stringbuilder but not in system.string.

To prevent a class from being inherited, the sealed keyword in C# can be used. The NotInheritable keyword can be used in VB.NET to prevent accidental inheritance of the class.

Managed code is a code created by the .NET compiler. It does not depend on the architecture of the target machine because it is executed by the CLR (Common Language Runtime), and not by the operating system itself. CLR and managed code offers developers few benefits, like garbage collection, type checking and exceptions handling.

On the other hand, unmanaged code is directly compiled to native machine code and depends on the architecture of the target machine. It is executed directly by the operating system. In the unmanaged code, the developer has to make sure he is dealing with memory usage and allocation (especially because of memory leaks), type safety and exceptions manually.

In .NET, Visual Basic and C# compiler creates managed code. To get unmanaged code, the application has to be written in C or C++.

Hash table stores data in the form of value pair and name while Array list stores only values.

You need to pass name to access value from the Hash table while in Array, you need to pass index number to access value.

In Array, you can store only similar type of data type while in Hash table you can store different type of data types. ex. int, string etc.

There is no difference between int and int32. System. Int is an alias name for System.Int32 which is a .Net Class.

Both loops are used when a unit of code needs to execute repeatedly. The difference is that the for loop is used when you know how many times you need to iterate through the code. On the other hand, the while loop is used when you need to repeat something until a given statement is true.

The syntax of the while loop in C# is:

while (condition [is true])
// statements
The syntax of the while loop in VB.NET is:

While condition [is True]
‘ statements
End While
The syntax of the for loop in C# is:

for (initializer; condition; iterator)
// statements
The syntax of the for loop in VB.NET is:

For counter [ As datatype ] = start To end [ Step step ]
‘ statements
Next [ counter ]

Inheritance is one of the most important concepts in object-oriented programming, together with encapsulation and polymorphism. Inheritance allows developers to create new classes that reuse, extend, and modify the behavior defined in other classes. This enables code reuse and speeds up development. With inheritance, developers can write and debug one class only once, and then reuse that same code as the basis for the new classes. The class whose members are inherited is called the base class, and the class that inherits those members is called the derived class. By default, all classes in .NET are inheritable.

Immutable means once you create a thing, you cannot modify it.

For example: If you want give new value to old value then it will discard the old value and create new instance in memory to hold the new value.

An assembly is a physical grouping of logical units while namespace groups classes. A namespace can span multiple assemblies.

The stack is used for static memory allocation and access to this memory is fast and simple to keep track of. Heap is used for dynamic memory allocation and memory allocation to variables happens at run time. Accessing the heap memory is complex and slower compared to stack.

An interface merely declares a contract or a behavior that implementing classes should have. It may declare only properties, methods, and events with no access modifiers. All the declared members must be implemented.

An abstract class provides a partial implementation for a functionality and some abstract/virtual members that must be implemented by the inheriting entities. It can declare fields too.

Neither interfaces nor abstract classes can be instantiated.

Executing code is an essential function of any developer, but knowledge of executing managed code is specific to the .NET Framework. Your answer should explain how to execute code that runs inside the common language runtime environment the framework provides.

Additionally, whenever an interviewer asks you to explain something in “basic terms,” it’s important to pay attention to the language you use to make it as clear as possible. These types of questions are often asked when the position requires the candidate to be both very technical and also a good communicator who can explain their work to a broad audience. In some organizations, a lead developer may be responsible for reporting progress on an application to stakeholders. During these exchanges, they should be able to break down their work without using technical jargon or overly complicated language.

Example: “First, I would write the code. Then I would compile the code with a resource called a compiler. Using the compiler, I would convert the managed code into an intermediate language. The intermediate language will be targeted by the Common Language Runtime within .NET Framework and converted to native code that can then be executed inside the framework.

In my previous role as a developer, I was tasked with speeding up application delivery times. Using .NET and this process for executing managed code, I was able to reduce delivery timelines by 5% overall.”

The advantages of Web Services are:

i. It is simple to build and supported by a variety of platforms.

ii. It can extend its interface and add new methods without affecting the client’s operations.

iii. It is stateless and firewall-friendly.

Garbage collection is used to prevent memory leaks during execution of programs. There is a low-priority process name as garbage collector manages the allocation and deallocation a memory for applications. It also checks for the unreferenced variables and objects. If there is ny object which is no further used by application the Garbage collector frees up the memory from that object.

The Hashtable class is a collection that stores key-value pairs. It organizes the pairs based on the hash code of each key and uses it to access elements in the collection.

Following are the main differences between value type and reference type:

  • Value type contain variable while reference type doesn’t contain value directly in its memory
  • In reference type, memory is allocated in managed heap and in value type memory allocated in stack.
  • Reference type ex-class value type-struct, enumeration

Simula was the first OOP language and Java, JavaScript, Python, C++, Visual Basic. NET, Ruby, Scala, PHP are few others.

Garbage collection is an essential process of the .NET Framework that performs memory usage optimization to allow for greater effectiveness of the platform. Answering this question allows you to show you’re an expert on the subject of .NET. It demonstrates knowledge of the framework that goes beyond just repeating theoretical concepts.

Example: “The .NET Framework uses the garbage collector to release unused code lying in the memory. The garbage collector will release code at different times for the three different generations divided within the memory. Since the code objects in Generation 0 are generally short-lived, the garbage collector will frequently release the code objects here, where objects in Generations 1 and 2 will be released less often.

In the first phase of garbage collection, the collector identifies a list of live objects. Then, the collector updates the references for the objects the collector will compact. In phase three, the collector reclaims the spaces taken up by the dead code objects. The code that remains is then transported to an older segment.”

Other questions that ask about the essential features of .NET might include:

  • What is the difference between Server.Transfer and Response.Redirect?
  • What is passport authentication?
  • What is CAS?

The session object is used to maintain the session of each user.

For example: If a user enters into the application then he will get a session id. If he leaves from the application then the session id is deleted. If he again enters into the application, he will get a different session id.

But in the case of application object the id is maintained for whole application.

Garbage collection is a low-priority process that serves as an automatic memory manager which manages the allocation and release of memory for the applications. Each time a new object is created, the common language runtime allocates memory for that object from the managed Heap. As long as free memory space is available in the managed Heap, the runtime continues to allocate space for new objects. However, memory is not infinite, and once an application fills the Heap memory space, garbage collection comes into play to free some memory. When the garbage collector performs a collection, it checks for objects in the managed Heap that are no longer being used by the application and performs the necessary operations to reclaim the memory. Garbage collection will stop all running threads, it will find all objects in the Heap that are not being accessed by the main program and delete them. It will then reorganize all the objects left in the Heap to make space and adjust all the Pointers to these objects in both the Stack and the Heap.

To enforce garbage collection in your code manually, you can run the following command (written in C#):


The main disadvantages of cookies are:

  • Cookie can store only string value.
  • Cookies are browser dependent.
  • Cookies are not secure.
  • Cookies can store only small amount of data.

In short, a class is the definition of an object, and an object is instance of a class.

We can look at the class as a template of the object: it describes all the properties, methods, states and behaviors that the implementing object will have. As mentioned, an object is an instance of a class, and a class does not become an object until it is instantiated. There can be more instances of objects based on the one class, each with different properties.

The difference between function and stored procedure:

  • Function returns only one value but procedure can return one or more than one value.
  • Function can be used in select statements but procedure cannot be used.
  • Function has only input parameters while Procedure can have an input and output parameters.
  • Exceptions can be handled by try catch block in procedures but that is not possible in function.

CTS stands for Common Type System. It follows certain rules according to which a data type should be declared and used in the program code. CTS also describes the data types that are going to be used in the application. We can even make our own classes and functions following the rules in the CTS, it helps in calling the data type declared in one program language by other programming languages.

We can use the web.config file to specify the themes

  1. <cofiguration>
  2. <system.web>
  3. <pages theme="windows"/>
  4. </system.web>
  5. </configuration>

System.string is immutable and fixed-length, whereas StringBuilder is mutable and variable length. The size of .string cannot be changed, but that of .stringbuilder can be changed.

There is a property, named as “IsPostBack” property. You can check it to know that the page is post backed or not.

There are two types of assemblies:

  • Private Assembly: It is accessible only to the application, it is installed in the installation directory of the application.
  • Shared Assembly: It can be shared by multiple applications, it is installed in the GAC.

The basic features of OOP are:

Encapsulation: Creation of self-contained modules that bind together the data and the functions that access that data.

Abstraction: Handles complexity and allows the implementation of further complex logic without disclosing it to the user object.

Polymorphism: Operation performed depends upon the context at runtime to facilitate easy integration.

Inheritance: Creation of classes in a hierarchy to enable a class inherit behavior from its parent class allowing reuse of code.

Polymorphism refers to one interface with multiple functions. It means that the same method or property can perform different actions depending on the run-time type of the instance that invokes it.

The Application object is used to share information among all users of an application. You can tie a group of ASP files that work together to perform some purpose.

The advantages of using session are:

  • A session stores user states and data to all over the application.
  • It is very easy to implement and we can store any kind of object.
  • It can store every user data separately.
  • Session is secure and transparent from user because session object is stored on the server.

in the Stack are stored value types (types inherited from System.ValueType), and in the Heap are stored reference types (types inherited from System.Object).

We can say the Stack is responsible for keeping track of what is actually executing and where each executing thread is (each thread has its own Stack). The Heap, on the other hand, is responsible for keeping track of the data, or more precise objects.

Object-Role Modeling (ORM) is a powerful method for designing and querying information systems at the conceptual level. It is an easy and understandable description of the application for non-technical users.

There is a property named “IsClosed” property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.

Object Pooling is a concept for optimal use of limited resources through software constructs. The ready-to-use objects, connections, and threads are stored in a pool (group) of objects in memory for later use. For creating a new object, it is pulled from the pool and allocated for the request. Pooling helps in improving performance and facilitates scalability.

Client-side validations take place at the client end with the help of JavaScript and VBScript offering a better user experience. The inputs for client-side validation are validated in the user’s browser. While, server-side validations take place at the server end using ASP.Net and PHP, and the feedback is sent through a dynamically generated new webpage.

CLR stands for common language run-time, it is an important component of the .NET framework. We can use CLR as a building block of various applications and provides a secure execution environment for applications.

Whenever an application written in C# is compiled, the code is converted into an intermediate language. After this, the code is targeted to CLR which then performs several operations like memory management, security checks, loading assemblies, and thread management.

During the passport authentication, it first checks the passport authentication cookie, if the cookie is not available the application redirects to the passport sign on page. Passport service then authenticates the details of the user on the sign on page and if they are valid, stores them on the client machine and then redirects the user to the requested page.

The For loop provides a concise way of writing the loop structure, but the While loop is a control flow statement that allows repetitive execution of the code. Initialization, condition checking, iteration statements are written at the top of the For loop, but only initialization and condition checking is done at the top of the while loop.


  1. While loop:
  2. while(condtion) {
  3. //statements to excute.
  4. }
  5. For loop:
  6. for(intialization; condition; Increment or decrement)
  7. {
  8. // statements to be excuted.
  9. }

It is a platform for building various applications on windows. It has a list of inbuilt functionalities in the form of class, library, and APIs which are used to build, deploy and run web services and different applications. It supports different languages such as C#, VB .Net, Cobol, Perl, etc.

This framework supports the object-oriented programming model.

Variable: A variable is a data storage location in the computer memory that contains a value and has a meaningful name. Every variable is attached to a data type which determines what type of value can be stored in the variable.

Variables can be declared by using the following syntax:

Constant: Constant is also similar to the variable except that the value. Value once assigned to a constant can’t be changed. Constants must be initialized at the same time they are declared.

Constants can be declared by using the following syntax:

const int interestRate =10;

  • MDI( Multiple Document Interface): An MDI lets you open multiple windows, it will have one parent window and as many child windows. The components are shared from the parent window like menubar, toolbar, etc.
  • SDI( Single Document Interface): It opens each document in a separate window. Each window has its own components like menubar, toolbar, etc. Therefore it is not constrained to the parent window.

JIT stands for Just In Time. It is a compiler in CLR responsible for the execution of .NET programs of different languages by converting them into machine code. It speeds up the code execution and supports multiple platforms.

There are two types of Polymorphism:

i. Static or compile-time polymorphism

ii. Dynamic or runtime polymorphism

A Session object stores information and variables about a user and retains it through the session.

In LINQ, deferred execution simply means that the query is not executed at the time it is specified. Specifically, this is accomplished by assigning the query to a variable. When this is done, the query definition is stored in the variable but the query is not executed until the query variable is iterated over. For example:

DataContext productContext = new DataContext();

var productQuery = from product in productContext.Products
where product.Type == “SOAPS”
select product; // Query is NOT executed here

foreach (var product in productQuery) // Query executes HERE
You can also force immediate execution of a query. This can be useful, for example, if the database is being updated frequently, and it is important in the logic of your program to ensure that the results you’re accessing are those returned at the point in your code where the query was specified. Immediate execution is often forced using a method such as Average, Sum, Count, List, ToList, or ToArray. For example:

DataContext productContext = new DataContext();

var productCountQuery = (from product in productContext.Products
where product.Type == “SOAPS”
select product).Count(); // Query executes HERE

The disadvantages of using session are:

  • Performance overhead occurs in case of large number of users, because session data is stored in server memory.
  • Overhead involved in serializing and De-Serializing session Data. Because In case of StateServer and SQLServer session mode we need to serialize the object before store.

Globalization is designing and coding culture-neutral and language-neutral applications. Localization is customizing the application and translating the UI based on specific cultures and regions.

The following two requirements must be fulfilled for connection pooling:

  • There must be multiple processes to share the same connection describing the same parameters and security settings.
  • The connection string must be identical.

Serialization is the process of converting the state of an object into a form (a stream of bytes) to be persisted or transported. Deserialization converts a stream into an object and is the opposite of serialization. These processes allow data to be stored and transferred.

Common language specification helps the developers to use the components that are inter-language compatible with certain rules that come with CLS. It then helps in reusing the code in other .NET compatible languages.

  • <asp: Login>: Provides a login capability that enables the users to enter their credentials.
  • <asp: LoginName>: Allows you to display the name of the logged-in user.
  • <asp: LoginStatus>:Displays if the user is authenticated or not.
  • <asp: LoginView>: provides various login views depending on the template that has been selected.
  • <asp: PasswordRecovery>: Emails the users the lost passwords.

The base class is a class whose members and functions can be inherited, and the derived class is the class that inherits those members and may also have additional properties.

The components of .Net are Common language run-time, .Net Class library, Application domain, Common Type System, .Net framework, Profiling, etc. However, the two important components are the Class library and the Common Language Runtime.

CLR provides building blocks for a wide variety of applications. The class library consists of a set of classes that are used to access common functionality. The functionality can be shared among different applications.

In Visual basic, we can use Select-Case statement to replace multiple If-Else statement. In C#, we should use Switch-Case statement to replace multiple If-Else statement.

Garbage collector feature in .NET frees the unused code objects in the memory. The memory head is divided into 3 generations:

  • Generation 0: It stores short-lived objects.
  • Generation 1: This is for medium-lived objects.
  • Generation 2: It stores long-lived objects.
    Collection of garbage refers to the collection of objects stored in the generations.

There are 3 types of JIT Compilers:

i. Pre-JIT compiler: It compiles all the source code into the machine code in a single compilation cycle, i.e. at the application deployment time.

ii. Normal JIT Compiler: The source code methods required at run-time are compiled into machine code and stored in the cache to be called later.

iii. Econo JIT Compiler: The methods required only at run-time are compiled using this compiler and they are not stored for future use.

No, .NET supports only single inheritance due to the diamond problem. Also, it would add complexity when used in different languages. However, multiple interfaces can solve the purpose.

Managed code runs inside CLR and installing the .NET Framework is necessary to execute it. Unmanaged code does not depend on CLR for execution and is developed using languages outside the .NET framework.

Yes. Session out time can be set manually in web.config.

A delegate in .NET is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked. In addition, we could use delegate to create custom event within a class. For example,

public delegate void FooDelegate();

class FooClass
// custom event
public event FooDelegate FooEvent;

FooClass FooObj = new FooClass()
FooObj.FooEvent += new FooDelegate();

MIME stands for Multipurpose Internet Mail Extension. It is an add-on or a supplementary protocol which allows non-ASCII data to be sent through SMTP. It facilitates the exchange of data files on the internet and was proposed by Bell Communications in 1991.

OleDbDataAdapter is used to get the data from an Access database.

PE stands for Portable Executable. It is a derivative of the Microsoft Common Object File Format (COFF). Windows executable, .EXE or DLL files follow the PE file format. It consists of four parts:

1. PE/COFF headers- Contains information regarding .EXE or DLL file.

2. CLR header- Contains information about CLR & memory management.

3. CLR data- Contains metadata of DDLs and MSIL code generated by compilers.

4. Native image section- Contains sections like .data, .rdata, .rsrc, .text etc.

JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native language. During the execution, the intermediate code is converted into the native language.

  • ItemTemplate
  • AlternatingItemTemplate
  • SeparatorTemplate
  • HeaderTemplate
  • FooterTemplate

The extension method is used to add new methods in the existing class or the structure without modifying the source code of the original type. Special permission from the original type or re-compiling it isn’t required.

CTS stands for Common Type System. It has a set of rules which state how a data type should be declared, defined and used in the program. It describes the data types that are to be used in the application.

We can design our own classes and values by following the rules that are present in the CTS. The rules are made so that the data type declared using a programming language can be called by an application that is developed using a different language.

There are two types of indexes in .Net:

Clustered index and non-clustered index

Caching simply means storing the data temporarily in the memory so that the data can be accessed from the memory instead of searching for it in the original location. It increases the efficiency of the application and also increases its speed.

Following are the types of caching:

  • Page caching
  • Data caching
  • Fragment caching

BCL stands for Base Class Library. It comprises classes, interface, and value types. It is the foundation for building .NET Framework applications, components, and controls.

It is an ambiguity that arises due to multiple inheritances in C#. Two classes B and C inherit from A, and D inherits from both B and C but doesn’t override the method defined in A. The Diamond Problem arises when class B or C has overridden the method differently and D cannot decide to inherit from either B or C.

The steps for executing a managed code are as follows:

  • Choose a language compiler depending on the language of the code.
  • Convert the code into Intermediate language using its own compiler.
  • The IL is then targeted to CLR which converts the code into native code using JIT.
  • Execution of Native code.

Boxing: Boxing is a process of converting value type into reference type.

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

It’s not possible, as the WebAPI runtime needs to know the method signatures in advance.

There are 23 design patterns classified into 3 categories:

1. Creational Design Pattern

i. Factory Method

ii. Abstract Factory

iii. Builder

iv. Prototype

v. Singleton

2. Structural Design Patterns

i. Adapter

ii. Bridge

iii. Composite

iv. Decorator

v. Façade

vi. Flyweight

vii. Proxy

3. Behavioral Design Patterns

i. Chain of Responsibility

ii. Command

iii. Interpreter

iv. Iterator

v. Mediator

vi. Memento

vii. Observer

viii. State

ix. Strategy

x. Visitor

xi. Template Method

The following parameters control the connection pooling behavior:

  • Connect Timeout
  • Max Pool Size
  • Min Pool Size
  • Pooling

AutoPostBack is a property which is used to postback automatically when an event is raised. You have to set the AutoPostBack property of the control to True.

Response.Redirect basically redirects the user’s browser to another page or site. The history of the user’s browser is updated to reflect the new address as well. It also performs a trip back to the client where the client’s browser is redirected to the new page.

Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to the client’s browser. The history does not get updated in the case of Server.Transfer.

EXE files are single outbound files that cannot be shared with other applications. DLL files are multiple inbound files that are shareable.

Every request into an ASP.NET application is handled by a specialized component called HTTP handler. It is the most important component for handling ASP.NET application requests.

It uses different handlers to serve different files. The handler for web page creates the page and control objects, runs your code and then renders the final HTML.

Following are the default HTTP handlers for ASP.NET:

  • Page Handler(.aspx): Handles web pages
  • User Control Handler(.ascx): It handles web user control pages
  • Web Service Handler(.asmx): Handles web service pages
  • Trace Handler(trace.axd): It handles trace functionality

There are two types of memories in .Net

  • Stack memory
  • Heap Memory

ASP.NET introduces a concept of application domain or AppDomain which is like a lightweight process that acts like both container and boundary. The .NET run-time uses the AppDomain as a container for data and code. The CLR allows multiple .NET applications to run in a single AppDomain.

FCL stands for Framework Class Library, and is a collection of reusable types, including classes, interfaces, and data types included in the .NET Framework. It is used for developing a wide variety of applications, as it provides access to system functionality.

An interface is a declaration for a set of class members. It is a reference type that contains only abstract members such as Events, Methods, Properties, etc.

CLR stands for Common Language Runtime. It is one of the most important components of the .Net framework. It provides building blocks for many applications.

An application built using C# gets compiled by its own compiler and is converted into an Intermediate language. This is then targeted to CLR. CLR does various operations like memory management, security checks, assemblies to be loaded and thread management. It provides a secure execution environment for applications.

The different parts of an Assembly are:

i. Manifest – Also known as the assembly metadata, it has information about the version of an assembly.

ii. Type Metadata – Binary information of the program.

iii. MSIL – Microsoft Intermediate Language code.

iv. Resources – List of related files.

Inheritance is a method for creating hierarchies of objects wherein one class, called a subclass, is based on another class, called a base class.

.Net uses the SOLID design principle which includes the following:

  • Single responsibility principle (SRP)
  • Open-Closed Principle (OCP)
  • Liskov substitution principle (LSP)
  • Interface segregation principle (ISP)
  • Dependency inversion principle (DIP)

Marshaling is the process of transforming types in the managed and unmanaged code.

The DataSource property and the DataMember property are used to bind a DataGridView control.

Dataset.clone copies only the structure of the DataSet which includes all DataTable schemas, relations, and constraints but it does not copy any data. Dataset.copy is a deep copy of the DataSet that duplicates both its structure and data.

A list of new features of .NET Framework 4.0:

  • Improved Application Compatibility and Deployment Support
  • Dynamic Language Runtime
  • Managed Extensibility Framework
  • Parallel Programming framework
  • Improved Security Model
  • Networking Improvements
  • Improved Core ASP.NET Services
  • Improvements in WPF 4
  • Improved Entity Framework (EF)
  • Integration between WCF and WF
  • Session Cookie: It resides on the client machine for a single session until the user logs out.
  • Persistent Cookie: Resides on the user machine for a period specified for its expiry. It may be an hour, a month or never.

Stored Procedure:

  • A Stored Procedure is always used to perform a specific task.
  • It can return zero, one or more value.
  • It can have both input and output parameters.
  • Exception handling can be done using a try-catch block.
  • A function can be called from a Procedure.
  • Functions must return a single value.
  • It can only have the input parameter.
  • Exception handling cannot be done using a try-catch block.
  • A Stored procedure cannot be called from a function.

A delegate in .NET is similar to a function pointer in other programming languages like C or C++. A delegate allows the user to encapsulate the reference of a method in a delegate object. A delegate object can then be passed in a program, which will call the referenced method. We can even use a delegate method to create a custom event in a class.

Caching functionality in .NET Framework allows data storage in memory for rapid access. It helps improve performance by making data available, even if the data source is temporarily unavailable and enhances scalability.

Events notify other classes and objects when the desired action occurs in a class or object. A delegate is a type-safe function pointer that defines a method signature in CLI.

MVC is an architectural model for building the .Net applications. It stands for Model View Controller. It is easy to use and offers full control over the HTML.

HttpHandler is a low level request and response API which is made to service incoming Http request. Every incoming Http request recieved by ASP.NET is ultimately processed by a instance of a class that implements HttpHandler.

  • BCL is a base class library of classes, interfaces and value types
  • It is the foundation of .NET framework applications, components, and controls
  • Encapsulates a huge number of common functions and make them easily available for the developers
  • It provides functionality like threading, input/output, security, diagnostics, resources, globalization, etc.
  • Also serves the purpose of interaction between user and runtime
  • It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.

Inheritance hierarchy is a singly rooted tree structure for organizing classes.

An assembly is a physical grouping of logical units whereas namespace groups classes. Also, a namespace can span multiple assemblies as well.

Implementation inheritance is when a class inherits all members of the class from which it is derived. Interface inheritance is when the class inherits only signatures of the functions from another class.

Boxing and Unboxing is a concept of C#, which enables a unified view of the type system to treat the value of any type as an object.

This is a common way for interviewers to start an interview for a software developer who needs to specialize in the .NET Framework. Show the interviewer your ability to utilize the .NET Framework effectively by describing what it is, when to use it and its main features. Try to show your practical knowledge of the system.

Example: “.NET is a Microsoft framework designed to help developers work with different coding languages. In simple terms, it’s a virtual machine that assists with the compilation, conversion and execution of code within a development framework. Using .NET, developers can create form- and web-based applications and services.”

The ErrorProvider control is used to indicate invalid data or error to the end user while filling a data entry form. In case of invalid data entry the error message attached to the error description string is displayed next to the control.

A cookie is a small amount of data created by server on the client. When a web server creates a cookie, an additional HTTP header is sent to the browser when a page is served to the browser.

.NET is a framework for software development. It is just like other software development framework like (J2EE). It provides runtime capabilities and a rich set of pre-built functionality in the form of class library and API’s. This .NET framework is an environment to build, deploy and run web services and other applications.

The .NET framework contains three main parts:

  • Common Language Runtime
  • Framework classes

Stored Procedures are pre-compiled objects which execute the code when called for. While a Function is compiled and executed when it is called for.

.Net provides a security model that prevents unauthorized access to resources. CAS is a part of that security model. CAS is present in the CLR. It enables the users to set permissions at a granular level for the code.

CLR then executes the code depending on the available permissions. CAS can be applied only to the managed code. Unmanaged code runs without CAS. If CAS is used on assemblies, then the assembly is treated as partially trusted. Such assemblies must undergo checks every time when it tries to access a resource.

EXE and DLL are assembly executable modules.

EXE: It is an executable file that runs the application for which it is designed. When we build an application, an exe file is generated. Therefore the assemblies are loaded directly when we run an exe. But an exe file cannot be shared with other applications.

DLL: It stands for dynamic link library that consists of code that needs to be hidden. The code is encapsulated in this library, an application can have many DLLs and can also be shared with other applications.

There are 3 types of caches in .NET:

  • In-Memory Cache
  • Persistent in-process Cache
  • Distributed Cache

It is the application processing layer that coordinates between the User Interface Layer and Data Access Layer.

System.Object provides the following important methods, among others:

  1. ToString—Returns a string that represents the current object
  2. both overrides of Equals(object), Equals(object, object)
  3. GetHashCode
  4. Finalize
  5. GetType
  6. ReferenceEquals
  7. MemberwiseClone
    Most of these methods provide the basic implementation required of any type that a developer will work with in the .NET stack.

.NET Framework facilitates the developer to develop, run and deploy the applications like console application, window Forms applications, web applications, web services, window services etc. It also provides environment to create sharable components to be used in distributed computing architecture.

Main components of .Net Framework:

  • Class library
  • Common Language Runtime (CLR)
  • Dynamic Language Runtime (DLR)
  • Application Domains
  • Runtime Hosts
  • Cross-language interoperability
  • Framework security
  • Profiling etc.

It is an acronym for Language integrated query which was introduced with visual studio 2008. LINQ is a set of features that extend query capabilities to the .NET framework language syntax that allows data manipulation irrespective of the data source. LINQ bridges the gap between the world of objects and the world of data.

A constructor is a special method of the class that contains a collection of instructions and gets automatically invoked when an instance of the class is created.

These are used to redirect a user from one web page to the other one. The Response.Redirect method requests a new URL and specifies the new URL. The Server.Transfer method terminates the execution of the current page and starts the execution of a new page.

NET is an infrastructure that consists of multiple features like application domain, a common type system and profiling. Isolating one or two important pieces may be a challenge, but the interviewer may be looking for the answers “class library” and “Common Language Runtime.” It’s critical to make a case for why those are the most essential features. This is an opportunity to show your skills go beyond just technical because you can also apply critical thinking.

Example: “Common Language Runtime and Class library are the most important aspects of the .NET Framework. CLR provides building tools and resources that help developers set the foundation for application building. The class library holds essential classes used for providing commonly known functionality that is shareable across applications.”

.NET is a developer platform to build a variety of applications for web, mobile, desktop, and IoT. It supports various languages like C#, F#, Visual Basic, J#, C++, etc. for building the applications.

Thread represents an actual OS-level thread, with its own stack and kernel resources, and allows the highest degree of control. You can choose to Abort() or Suspend() or Resume() a thread, and set thread-level properties, like the stack size, apartment state, or culture. While a Task class from the Task Parallel Library is executed by a TaskScheduler to return a result and allows you to find out when it finishes.

IL stands for Intermediate Language. It is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language).

All .NET source codes are first compiled to IL. Then, IL is converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

When .NET was introduced first time, it supports many languages like VB.NET,C#,COBOL, and Perl etc. At present time it supports almost 44 languages.

It is a component that allows publishing of the application’s function on the web to make it accessible to the public. It resides on a Web server and provides information and services using standard Web protocols such as HTTP and Simple Object Access Protocol (SOAP).

GAC stands for Global Assembly Cache. Whenever CLR gets installed on the machine, GAC comes as a part of it. GAC specifically stores those assemblies which will be shared by many applications. A Developer tool called Gacutil.exe is used to add any file to GAC

Following are the events in the page life cycle:

  • Page_PreInit
  • Page_Init
  • Page_InitComplete
  • Page_PreLoad
  • Page_Load
  • Page_LoadComplete
  • Page_PreRender
  • Render

Cross page posting is used to submit a form to a different page while creating a multi-page form to collect information from the user. You can specify the page you want to post to using the PostBackURL attribute.

A Component does not draw itself on the form and can be placed below the form area. A control draws itself on the form and can be placed inside the form area. Also, all controls are components, but not all components are controls.

Manifest is used to store assembly metadata. It contains all the metadata which are necessary for following things.

  • Version of assembly
  • Security identity
  • Scope of the assembly
  • To resolve references to resources and classes

Memory-mapped files are used to map the content of a file to the logical address of an application. It makes you able to run multiple process on the same machine to share data with each other. To obtain a memory mapped file object, you can use the method MemoryMappedFile.CreateFromFiles( ). It represents a persistent memory-mapped file from a file on disk.

MSIL is the Microsoft Intermediate Language, it provides instructions for calling methods, storing and initializing values, memory handling, exception handling and so on. All the .NET codes are first compiled to Intermediate Language.

There are 5 types of constructors in C#, as given below:

  • Default Constructor- It is without any parameters.
  • Parameterized Constructor- It has one parameter.
  • Copy Constructor- It creates an object by copying variables from another object.
  • Static Constructor- It is created using a static keyword and will be invoked only once for all of the instances of the class.
  • Private Constructor- It is created with a private specifier and does not allow other classes to derive from this class or create an instance of it.

Garbage Collection in .NET Framework facilitates automatic memory management. It automatically releases the memory space after all the actions related to the object in the heap memory are completed.

When developers work within an established framework, they should be aware of certain nuances, especially those between managed and unmanaged code. This question allows you to display your knowledge of working within the framework and to differentiate that knowledge from working in other coding environments.

Answering this question tests the depths of your programming knowledge and lets the interviewer know you are skilled enough to handle the various environments in the enterprise development lifecycle.

Example: “Managed code is managed by and runs inside the CLR and needs the .NET Framework to execute. Unmanaged code, on the other hand, does not need the CLR to execute. Unmanaged code is formulated from a language independent of the .NET Framework and therefore uses its independent environment for execution and compiling.”

Other questions an interviewer could ask to make sure you understand nuanced features of .NET include:

  • Explain the difference between function and stored procedure.
  • What are the different types of assemblies?
  • What are the elements of an assembly?
  • What are the two types of cookies in ASP.NET?

The .NET framework is a software development platform that supports an object-oriented approach. It offers services, like memory management, networking, security, and type-safety.

.NET is an OOP framework as Encapsulation and Inheritance are key features of the Object-Oriented Programming framework.

System.GC.Collect() method is used to enforce garbage collection in .Net.

The .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code is called managed code. This managed code is run in .NET environment. So after compilation the language is not a barrier and the code can call or use function of another language also.

MEF stands for Managed Extensibility Framework. It is a library that allows the host application to consume external extensions without any configuration requirement.

Internationalization is the process of designing applications that support multiple languages. This is divided into Localization and Globalization.

Globalization is nothing but developing applications to support different languages. Existing applications can also be converted to support multiple cultures.

Whereas Localization means changing the already globalized app to cater to a specific culture or language Microsoft.Extensions.Localization is used for localizing the app content. Some of the other keywords that are used for Localization are IHtmlLocalizer, IStringLocalizer, IViewLocalizer and so on

  1. mail message = new mail();
  2. message.From = “”;
  3. message.To = “”;
  4. message.Subject = “Test”;
  5. message.Body = “hello”;
  6. SmtpMail.SmtpServer = “localhost”;
  7. SmtpMail.Send(message);

Constant fields are created using const keyword and their value remains the same throughout the program. The Read-only fields are created using a read-only keyword and their value can be changed. Const is a compile-time constant while Read-only is a runtime constant.

User and Custom controls inherit from different levels in the inheritance tree. Custom control is designed for use by a single application while user control can be used by more than one application.

All web forms are inherited from page class.

Method Overriding is a process that allows using the same name, return type, argument, and invoking the same functions from another class (base class) in the derived class.

The memory heap is divided into three generations.

Generation 0 – Used to store short-lived objects. Frequent Garbage Collection happens in this Generation.

Generation 1 – Used for medium-lived objects.

Generation 2 – Used for long-lived objects.

Boxing is the process of converting a value type to the type object, and unboxing is extracting the value type from the object. While the boxing is implicit, unboxing is explicit.

Example (written in C#):

int i = 13;
object myObject = i; // boxing
i = (int)myObject; // unboxing

.NET Framework supports over 60 programming languages, out of these 11 programming languages are designed and developed by Microsoft.

Multi-threading is a process that contains multiple threads each of which performs different activities within a single process. .NET supports multithreading in two ways:

i. Starting threads with ThreadStart delegates.

ii. Using the ThreadPool class with asynchronous methods.

A tuple is a fixed-size collection that can have elements of either same or different data types. The user must have to specify the size of a tuple at the time of declaration just like arrays.

Yes, ASP.NET is different from ASP. These are the main differences:

  • ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server Pages) is a Microsoft’s server side technology use to create web pages.
  • ASP.NET is compiled while ASP is interpreted.
  • ASP uses the technology named ADO while ASP.NET uses ADO.NET.
  • ASP.NET is completely object oriented while ASP is partially object oriented.

Tuples are data structures that hold object properties and contain a sequence of elements of different data types. They were introduced as a Tuple class in .NET Framework 4.0 to avoid the need of creating separate types to hold object properties.

Garbage collection is a .Net feature to free the unused code objects in the memory.

The memory heap is divided into three generations. Generation 0, Generation 1 and Generation 2.

Generation 0 – This is used to store short-lived objects. Garbage Collection happens frequently in this Generation.
Generation 1 – This is for medium-lived objects. Usually, the objects that get moved from generation 0 are stored in this.
Generation 2 – This is for long-lived objects.
Collecting a Generation refers to collecting the objects in that generation and all its younger generations. Garbage collection of Generation 2 means full garbage collection, it collects all the objects in Generation 2 as well as Generation 1 and Generation 0.

During the Garbage collection process, as the first phase, the list of live objects is identified. In the second phase, references are updated for those objects which will be compacted. And in the last phase, the space occupied by dead objects are reclaimed. The remaining objects are moved to an older segment.

  • Application Events:
  • Application_Start, Application_End, Application_AcquireRequestState, Application_AuthenticateRequest,
  • Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest,
  • Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
  • Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState,
  • Application_ResolveRequestCache, Application_UpdateRequestCache
  • Session Events:
  • Session_Start, Session_End

Types in .NET Framework are either Value Type or Reference Type. A Value Type is stored in the stack and it holds the data within its own memory allocation. While a Reference Type is stored in the heap and it contains a pointer to another memory location that holds the real data.

Functional requirements are the basic and mandatory facilities that must be incorporated into a system. Non-functional requirements are quality-related attributes that the system must deliver.

Role-based security is used to implement security measures based on the role assigned to the users in the organization. Then we can authorize users based on their roles in the organization. For example, windows have role-based access like user, administrators, and guests.

EXE is an executable file that works as an application and it runs individually as it contains an entry point. DLL is a Dynamic Link Library which is a supportive file to other applications, and it cannot run individually.

Reflection objects are used for creating type instances and obtaining type information at runtime. The classes in the System.Reflection namespace gives access to the metadata of a running program.

Although Dispose and Finalize both methods are used by CLR to perform garbage collection of runtime objects of .NET applications but there is a difference between them.

The Finalize method is called automatically by the runtime while the Dispose method is called by the programmer.

Following are the different parts of assembly:

  • Manifest: It has the information about the version of the assembly.
  • Type Metadata: Contains the binary information of the program
  • MSIL: Microsoft Intermediate Language Code
  • Resources: List of related files

.NET is an open-source platform containing around 32 programming languages and several tools for application creation. It is highly secure and runs comfortably on multiple computer platforms.

Shadowing makes the method of the parent class available to the child class without using the override keyword. It is also known as Method Hiding.

The call to Debug class is included in Debug mode only and it is used at the time of application development. While the call to Trace class will be included in Debug as well as Release mode also and it is used at the time of application deployment.

While constants and read-only variable share many similarities, there are some important differences:

  • Constants are evaluated at compile time, while the read-only variables are evaluated at run time.
  • Constants support only value-type variables (the only exception being strings), while read-only variables can hold reference-
  • type variables.
  • Constants should be used when the value is not changing during run time, and read-only variables are used mostly when their actual value is unknown before run time.
  • Read-only variables can only be initialised at the time of declaration or in a constructor.

A tuple can hold up from 1 to 8 elements. In the case of more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.

State management is a technique that is used to manage a state of an object on different request. It is very important to manage state in any web application. There are two types of state management systems in ASP.NET.

  • Client side state management
  • Server side state management

ADO stands for ActiveX Data Objects. It is an application program for writing Windows applications. It is used to get access to a relational or non-relational database from database providers such as Microsoft and others.

The .NET framework supports an object-oriented approach that is used for building applications on windows. It supports various languages like C#, VB, Cobol, Perl, .NET, etc. It has a wide variety of tools and functionalities like class, library and APIs that are used to build, deploy and run web services and different applications.

Whenever we click on a submit button on a page, the data is stored on the same page. But if the data is stored on a different page, it is known as a cross-page posting.

Cross-page posting can be achieved by POSTBACKURL property which causes the postback.

FindControl method can be used to get the values that are posted on this page to which the page has been posted.

The values in a stack are processed following the LIFO (Last-In, First-Out) principle, so all elements are inserted and deleted from the top end. But a queue lists items on a FIFO (First-In, First-Out) basis in terms of both insertion and deletion. The elements are inserted from the rear end in a queue and deleted from the front end.

.NET security model is used to prevent unauthorized access of resources and operations and also restrict the codes to perform particular tasks. Code Access Security is a part of that .NET security.

In C#, we can use the sealed keyword to prevent a class from being inherited.

OOP is the acronym for Object-Oriented Programming. It is a programming structure that uses self- contained entities called ‘objects’ instead of methods to achieve the desired functionality. OOP allows .NET developers to create modular programs and classes containing methods, properties, fields, events, and other logical modules.

Shadowing is used to provide a new implementation for the base class method and helps protect against subsequent base class modification. Overriding allows you to rewrite a base class function with a different definition and achieve polymorphism.

Debug builds do not optimize and allow accurate setting of breakpoints. They contain debugging symbols, but the code built-in “Release” mode is optimized for speed or size without any debug data.

LINQ is an acronym for Language Integrated Query, and was introduced with Visual Studio 2008. LINQ is a set of features that extends query capabilities to the .NET language syntax by adding sets of new standard query operators that allow data manipulation, regardless of the data source. Supported data sources are: .NET Framework collections, SQL Server databases, ADO.NET Datasets, XML documents, and any collection of objects that support IEnumerable or the generic IEnumerable interface, in both C# and Visual Basic. In short, LINQ bridges the gap between the world of objects and the world of data.

The Global Assembly Cache is a machine-wide code cache that is stored in a folder in the Windows directory. It stores the .NET assemblies that are specifically designated to be shared by all applications executed on the system.

A Dataset follows the disconnected data architecture.

Debug class is used to debug builds while Trace is used for both debug and release builds.

There are two fundamental objects in ADO.NET:

i. DataReader- connected architecture.

ii. DataSet- disconnected architecture.

Following are the components of .NET

  • Common Language run-time
  • Application Domain
  • Common Type System
  • .NET Class Library
  • .NET Framework
  • Profiling