.Net interview questions

The .NET is an object-oriented framework 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.

In this article, you can go through the set of .NET interview questions most frequently asked in the interview panel. This will help you crack the interview as the topmost industry experts curate these at HKR training.

Let us have a quick review of the .NET interview questions.

Most Frequently Asked .NET Interview Questions

1. What is meant by .Net?

Ans. .Net is a popular software framework from Microsoft that is useful for developing apps that run on Windows. It supports various programming languages like C#, Perl, .Net, COBOL, etc., and offers excellent runtime capability with rich pre-built functionality. Moreover, .Net is closely related to other software development frameworks such as Java, J2EE, ASP.NET, etc.

2. What are the design principles used in .NET?

Ans: The .NET uses the following design principles.

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

3. What is CLR?


  • CLR is a major component of the .NET framework that stands for common language run-time. The CLR can be used as a building block of various applications and provides a secure environment for executing the applications.
  • Whenever a C# application 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.

4. What are the different parts of an Assembly?

Ans: The different parts of an assembly include.

  1. Manifest: It contains information about the version of the assembly.
  2. Type Metadata: It contains the binary information of the program.
  3. MSIL: Microsoft Intermediate Language Code.
  4. Resources: It contains a list of related files.

5. What is the difference between “Response.Redirect” and “Server.Transfer”?



It 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.


It transfers from one page to the other without making any round-trip back to the client’s browser. The history will not be updated in this scenario of “Server.Transfer”.

6. What is LINQ?


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

7. What is the difference between custom and user control?


Custom control:

  • It derives from control.
  • It is based on dynamic layout.
  • Defines a single control.
  • It has the support of a full toolbox.
  • It is loosely coupled.

User control:

  • It derives from the user control.
  • It is based on a static layout.
  • Defines a set of controls.
  • It cannot be added to the toolbox.
  • It is tightly coupled.

8. Can we assign null value into value type variable?

Ans: No but we can assign null values into reference type variable

9. When we will declare particular variable as nullable type?

Ans: Whenever an input is an optional that means not compulsory then we candeclare particular variable as NULLABLE TYPES

10. What is implicit type casting? When we will go for explicit type casing?



Converting from a Smaller size data type to a bigger size data type is called IMPLICIT TYPE CASTING


The type casting which is not possible by using implicit type casting then we have to go for EXPLICIT TYPE CASTING

11. List all the templates of the Repeater control.


  • ItemTemplate.
  • AlternatingItemTemplate.
  • SeparatorTemplate.
  • HeaderTemplate.
  • FooterTemplate.

12. Differentiate between constants and read-only variables.



  • Constants are evaluated at compile time.
  • It supports only the value type variables.
  • Constants are used when the value is not changing at compile time.
  • It cannot be initialized at the time of declaration or in a constructor.

Read-only variable:

  • Read-only variables are evaluated at run time.
  • It can hold the reference type variables.
  • Read-only variables are used when the actual value is unknown before the run-time.
  • It can be initialized at the time of declaration or in a constructor.

13. What are MDI and SDI?


MDI( Multiple Document Interface): 

This interface lets you open multiple windows, it contains one parent window with many child windows. The components are shared from the parent window like menubar, toolbar, etc.

SDI( Single Document Interface): 

This interface opens each document in a separate window. Each window has its own components like menubar, toolbar, etc. Hence it is not constrained to the parent window.

.NET Training Certification

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

14. What are the different validators in ASP.NET?

Ans: There are only two different validators in ASP.NET

  1. Client-side validation: It is the validation which is performed on the client-side browser. Generally, JavaScript is preferred for client-side validation.
  2. Server-side validation: It is the validation which is performed on the server. It is treated 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.

15. Write the simple code to send an email from an ASP.NET application.


mail message = new mail();

message.From = "abc@gmail.com";

message.To = "xyz@gmail.com";

message.Subject = "Test";

message.Body = "hello";

SmtpMail.SmtpServer = "localhost";


16. What is cross-page posting?


  • Upon clicking a submit button on a page, the data is stored on the same page. It is called cross-page posting when this data is stored on a different page.
  • Cross-page posting can be achieved by “POSTBACKURL” property which causes the postback.
  • FindControl() method is used for getting the values that are posted on this page to which the page has been posted.

17. How can you apply themes to an ASP.NET application?

Ans: To themes specification, the web.config file will be used in ASP.NET application.

18. What are ASP.NET security controls?


  • It enables the login capability for users to enter their credentials.
  • It allows you to display the name of the logged-in user.
  • It displays the status of the user if they are authenticated or not.
  • It provides various login views depending on the template that has been selected.
  • It emails the users who have lost their passwords.

19. What is the difference between ExecuteScalar and ExecuteNonQuery?



  • It returns an output value.
  • It is used for fetching a single value.
  • It doesn’t return any number of affected rows.


  • It doesn’t return any output value.
  • It is used to execute insert and update statements.
  • It returns the number of affected rows.

20. What is HTTP Handler?


  • HTTP handler is a specialized component that handles every request of an ASP.NET application. It is the most crucial component that handles application requests of ASP.NET.
  • It uses various handlers for serving different files. To a web page, the handler creates the page and controls objects which run your code and then delivers the final HTML.

Following are the default HTTP handlers for ASP.NET:

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

21. What is a delegate in .NET?


  • A delegate in .NET is a similar function pointer which is used in other programming languages such as C or C++. 
  • It 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. 
  • The delegate method is used for creating a custom event in a class.

22. What is the difference between DLL and EXE?



  1. These are outbound files.
  2. Only one “.exe” file exists per application.
  3. These files cannot be shared with other applications.


  1. These are inbound files.
  2. There can be many “.dll” files that may exist in one application.
  3. These files can be shared with other applications.

23. What is Object Pooling?


  • Object pooling is a concept of storing a pool which means a group of objects in memory that can be reused later as needed. 
  • Whenever a new object is created as per requirement, an object from the pool can be allocated for this request; thereby, minimizing the object creation. 
  • A pool is also referred to as a group of connections and threads. Hence it is helpful in minimizing the usage of system resources and improves system scalability and performance.

24. What is the difference between dataset.clone and dataset.copy?



It copies the structure of the DataSet which includes all DataTable schemas, relations and constraints. It doesn’t copy any data.


It copies both the structure and data for the DataSet. It is a deep copy which duplicates the structure and data.

25. What is the difference between managed and unmanaged code?


Managed code:

  • This code is managed by CLR.
  • The .NET framework is a must for executing the managed code.
  • CLR manages memory management through garbage collection.

Unmanaged code:

  • It is the code which is not managed by CLR.
  • It is independent of the .NET framework.
  • It uses its own runtime environment for compilation and execution.

26. What is ViewState?


  • It is a feature used by the ASP.NET Web page for storing the value of a page and its controls just before posting the page. 
  • Once the page is posted, the primary task of page processing is to restore the ViewState to retrieve the values of the controls.

27. What is the use of ErrorProvider Control in .NET?


  • The ErrorProvider control is used for indicating the invalid data on a data entry form. 
  • Using ErrorProvider control, the error messages can be attached which are displayed next to the control when the data is invalid.

28. What is the appSettings section in the “web.config” file?

Ans: In order to set the user-defined values for the whole application, the “appSettings” block that is available in the “web.config” file can be used.

29. What is the difference between the While and For loop? Provide a .NET syntax for both loops.


For Loop:

  • The For loop provides a concise way to write the structure of loop,
  • Initialization, condition checking, iteration statements are written at the top of the “for” loop.


for(intialization; condition; Increment or decrement){

// statements to be executed.


While Loop:

  • The While loop is a control flow statement that allows repetitive execution of the code. 
  • Only initialization and condition checking are done at the top of the while loop.


while(condition) {

//statements to execute.


30. Differentiate between Task and Thread in .NET.



  • The thread represents an actual OS-level thread, which contains its own stack and kernel resources, and allows the highest degree of control. 
  • It allows you to choose Abort() or Suspend() or Resume() methods and set thread-level properties, such as stack size, apartment state, or culture. 


  • A Task class from the Task Parallel Library is executed by a TaskScheduler.
  • The task returns a result and allows you to find out when it finishes.

31. What is the difference between function and stored procedure?



  • It must return a single value.
  • It can have only an input parameter.
  • Exception handling can’t be performed using a try-catch block.
  • Calling a stored procedure from a function is not possible.

Stored Procedure:

  • It always performs a specific task.
  • It can have both input and output parameters.
  • Exception handling can be performed using a try-catch block.
  • Calling a function from a stored procedure is possible.

32. What is caching?

Ans: Caching is the process of storing the data temporarily in the memory such that the data can be accessed from the memory instead of searching for it in the original location. It increases the speed and efficiency of an application.

Following are the types of caching:

  • Page caching.
  • Data caching.
  • Fragment caching.

33. What is a PE file?


  • 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.

34. What are the advantages of Informatica?


  • NET Framework is an important integral component in NET software
  • Net Framework is a runtime environment, which we can use to run net applications

35. What is Visual StudioNet?

Ans: AVisual Studio NET is a Microsoft-integrated development environment (IDE)that can be used for developing console applications, Windows Applications, Web Applications, Windows Service, Web service And so on

36. What is CLR?

ans: CLR Stands for Common Language Runtime,it is net execution
CLR is a common execution engine for all NET Languages that means every NET language application has to execute with the help of CLR

37. What is JIT Compiler?

Ans: AJIT (JUST-IN-TIME Compiler will convert MSIL (Microsoft Intermediate Language code to Native code because operating system can understand only Native code or machine code. 

38. What is CLS?


  • CLS (Common Language Specifications is a set of common language standard defined by the Microsoft for all NET Languages
  • Every NET Language has to follow CLS Standards
  • Whenever a Programming Language wants to recognize as NET Language then it has to follow CLS

39. When we will go for instance variable?

Ans: AWhenever we required a filed for multiple objects with the different values,then particular variable we will declare as INSTANCE VARAIBLE

40. Why class and object?



To achieve ENCAPSULATION, as well as for modularity


To allocate memory for instance variables & to store the address ofinstance method

Subscribe to our youtube channel to get new updates..!

41. What is Error, Bug and Defect?



--> Which comes at the time of development


 --> Which comes at the time of testing (Pre-Release)


 --> Which comes in Production (Post-Release

42. What is Boxing and Unboxing?



It is the process of converting from VALUE type toREFERENCE typeEx: converting from int to object


It is the process of converting from REFERENCE type toVALUE typeEX: converting from object to int

43. Why C#Net?

Ans: To develop any type of application by using .Net we require one NET language to write the business logic of that application.

44. What is the MaxValue and MinValue?

Ans: A Max Value and Min Value are predefined constants, which are members of every primitive data type structure except bool Using this Constant we can get the MINIMUM value and MAXIMUM value of a data type

45. What is Managed Code and Unmanaged Code?

Ans: .Net application may contain 2 types of codesAManaged Code BUnmanaged Code

Managed code:

The code which is taking the help of CLR for execution is called as managed code example for Managed Code:-All net languages code is managed codeVBNet code,
C#Net code…etc

Unmanaged code: -

The code which is not taking the help of CLR for execution is called asUnmanaged codeExample for Unmanaged Code:-In net application non net code is unmanaged codeVB Code,

VC++ Code…
Note: - net application can contain non net code

46. What are the different components of .NET?

Ans: The components of .NET are

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

47. What is meant by CTS?

Ans. CTS refers to the Common Type System, which specifies a set of rules. It states which data type can be declared and used in memory at runtime. It defines the data types to be used in the application. CTS is also helpful in preventing data loss while transferring data from one type of language to another. 

48. Define what BCL is?

Ans. BCL refers to the Base Class Library in .Net which is the foundation. Net's apps, controls, and components. It includes various classes, interfaces, etc., and helps interact between the user and runtime. Also, it offers some functionality such as threading, security, resources, diagnostics, etc. 

49. What do you mean by MVC?

Ans. MVC refers to Model View Controller, an architecture model helpful in creating applications in .Net. It is the base for building .Net applications.

Model - It helps to store and retrieve data from the database.

View  - It manages the UI and presents the charts, data tables, and other application contents.

Controller- It helps to manage user interactions and controls the application flow.

50. What are the memories supported in the .Net Framework?

Ans. Two types of memory support the .Net Framework- Stack memory and Heap memory.

51. What is meant by Cookies?

Ans. Cookies are small pieces of text information built by the server on the client side to locate users. It consists of user ID, username, password information, etc. 

52. Define the types of cookies used in ASP.Net.

Ans. The following are the types of cookies used in ASP.Net.

Session Cookie - These cookies reside on the client machine and are available for a single session

Persistent Cookie - These cookies are present on the user's machine and valid for many sessions.

53. What are Configuration Files in the .Net Framework?

Ans. Configuration files are the XML files that help to change and manage the settings of the website as per need. Web and Machine Configuration are the two types of Configuration files. 

54. What is Form-based Authentication in ASP.Net?

Ans. In ASP.Net, form-based authentication is a token-base helpful system to edit the web configuration files. When a user sends requests to the ASP.Net page through the browser, it verifies and redirects the user to the login page. After successful authentication, the user will be given access to the requested page. 

55. What is MIME, and Why is it used in .Net?

Ans. MIME refers to Multipurpose Internet Mail Extensions, an extension to the existing email protocols. It helps to exchange files over the internet. While doing a web transmission, the Servers add the MIME header at the beginning to represent it as a MIME transaction. 

56. What is meant by FCL in .Net?

Ans. FCL or Framework Class Library in .Net is a subpart of the Framework helpful in developing various applications. It also allows access to the system functionality and offers library support to the CLR for proper working. Moreover, it's a collection of reusable types that consists of interfaces, classes, data types, etc., under the .Net Framework.

57. Define CAS in .Net.

Ans. CAS or Code Access Security is the security model in .Net CLR that prevents unauthorized access. Also, it allows users to set specific permissions for the code, and the CLR will execute the code based on it. 

58. What do you mean by .Net Reflection?

Ans. In .Net, Reflection provides the objects to dynamically build type instances and then get the type information at runtime. Here, the System.Reflection namespace and the System.type Class plays crucial roles where System.Reflection allows accessing the running program's metadata. 

59. Define Garbage Collection .Net Framework.

Ans .Net's garbage collector automatically manages memory management by allocating and releasing the app's memory. It releases the memory space after completing all the heap memory-related activities. 

60. How will you execute a Managed Code in the .Net Framework?

Ans. CLR or Common Language Runtime helps to execute the managed code. Here, it would help if you had a language compiler based on the code's language. Then you need to transform the code into an intermediate language (IL) using the compiler. The intermediate language is then targeted to the CLR that transforms the code using JIT into a native code. Finally, execute the native code. 

61. Define .Net Web Service.

Ans. In .Net, a Web Service is a web server component that allows the publishing of an application's functions on the web. It makes it publicly accessible. Also, it provides information and services through standard web protocols like HTTP, SOAP, etc. 

62. Define MEF in .Net.

Ans. MEF refers to Managed Extensibility Framework, a .Net library helpful in building lightweight and extensible apps. It allows developers to use external extensions without the need for any configurations. 

63. What is meant by Serialization in .Net?

Ans. In .Net, Serialization is transforming an object's state into a form to be continued or transported. Deserialization is a complement to it which transforms the stream into an object. 

64. Is .Net an OOP Framework?

Ans. .Net is an object-oriented programming (OOP) framework as it has the features like Inheritance and Encapsulation found in an OOP language. 

.NET Training Certification

Weekday / Weekend Batches

65. Define Marshalling in .Net.

Ans. Marshaling is the process of converting types of managed and unmanaged (native) code in the .Net Framework.

66. What are the benefits of using Session State?

Ans. The Session State in .Net has the following benefits-

  • Easy to use and implement, similar to ViewState.
  • Stores user data throughout the application.
  • It stores the objects on the server. 
  • The Session is very secure.
  • It is helpful to store and recover values for a user. 

67. What is meant by IL (Intermediate Language)?

Ans. IL or Intermediate Language in .Net is an object-oriented programming language that compilers use. It is also called MSIL or CIL (Common Intermediate Language). Further, it is similar to bytecode and supports all object-oriented features like inheritance, data abstraction, etc. 

68. What are Design Patterns in .Net?

Ans. In .Net, Design Patterns are the reusable solutions for the standard software design issues that continuously occur in real-time app development. 

69. What are the types of Design Patterns in .Net.?

Ans. The following are the different types of Design Patterns:-

Creational Design Pattern

  • Factory Method
  • Builder
  • Prototype
  • Abstract Factory
  • Singleton

Behavioral Design Patterns

  • Chain of Responsibility
  • Command
  • Memento
  • Observer
  • State
  • Strategy
  • Interpreter
  • Iterator
  • Mediator
  • Visitor
  • Template Method

Structural Design Patterns

  • Adapter
  • Bridge
  • Composite
  • Decorator
  • Façade
  • Flyweight
  • Proxy

70. What is meant by State Management in ASP.Net?

Ans. State management in ASP.Net refers to managing a state of more than one user interface control within a GUI. There are two types of state management systems in ASP.Net - Client-side, and Server-side.

Find our upcoming .NET Training Certification Online Classes

  • Batch starts on 10th Dec 2022, Weekend batch

  • Batch starts on 14th Dec 2022, Weekday batch

  • Batch starts on 18th Dec 2022, Weekend batch

Global Promotional Image


Request for more information

Research Analyst
As a content writer at HKR trainings, I deliver content on various technologies. I hold my graduation degree in Information technology. I am passionate about helping people understand technology-related content through my easily digestible content. My writings include Data Science, Machine Learning, Artificial Intelligence, Python, Salesforce, Servicenow and etc.