.NET is among the most powerful frameworks to create a range of applications for Windows Desktop, Web applications, Windows Phone applications, Windows Store applications, Windows Server, Windows Azure (cloud) as well as Bot frameworks and cognitive services. .NET has proved to be an ever-growing employment segment that requires skilled professionals who can handle the task of creating applications efficiently.

This write up lists some of the most commonly asked top dot net interview questions and answers, which will help you to succeed in a dot net job interview.

Top Dot Net Interview Questions and Answers

These are the 40 top .Net interview questions and answers

Q1. What is .NET?

Ans. .Net is a software framework of Microsoft for developing the applications on Windows. It is similar to other software development frameworks like Java Platform, Enterprise Edition (J2EE), and comprises of ASP .Net, languages such as C#, VB .Net, COBOL, Perl, etc.

Q2. What is ASP.NET?

Ans. ASP.NET is another software framework to build web applications and is a part of the .NET Framework. ASP.NET helps to build the front end and runs on IIS, a Web Server.

Q3. What is CLR?

Ans. CLR refers to Common Language Run-time. It is an essential component of the .NET framework and can be used as a building block of various applications. An essential feature of CLR is that it ensures a secure execution environment for applications.

Q4. What is CLS?

Ans. CLS refers to Common Language Specification. It allows users to use inter-language compatible components and helps to reuse the code in other .NET compatible language.

Q5. Differentiate between boxing and unboxing.


Implicit conversionExplicit conversion
Object type refers to the value typeRetrieve value from the boxed object
int n = 12;
object ob = n;
int m = (int) ob;

Q6. What is BCL?

Ans. BCL refers to Base Class Library. It is the foundation of .NET framework applications, components, and controls. It comprises of basic, fundamental types like System.String and System.DateTime and offers functionalities like threading, input/output, security, diagnostics, etc.

Q7. What are cookies?

Ans. Cookies are small bits of text information. Cookies are created by the server on the client for identifying users. It may contain the username and ID, interests, password remember option, or any other information. Cookies are domain-specific.

Q8. Name some of the disadvantages of cookies.

Ans. The main disadvantages of cookies include –

  • Possible security risk, as they are stored in a clear text
  • Not secure, as encryption & decryption is easy
  • Cookies can be disabled on any user’s computer
  • Cookies can be edited or deleted
  • Cookies can store limited data.

Q9. How many languages are supported by .NET?

Ans. .NET supports almost 60 languages, including C#.NET, VB.NET, C++.NET, J#.NET, F#.NET, JSCRIPT.NET, WINDOWS POWERSHELL, etc.

Q10. Differentiate between ASP.NET and ASP.

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

ASP.NETActive Server Pages (ASP)
Creates dynamic web applicationsCreates web pages
Completely object-orientedPartially object-oriented

Q11. Explain state management in ASP.NET.

Ans. State management is the process of managing the state of one or more user interface controls such as text fields, OK buttons, radio buttons, etc. in a graphical user interface. Two types of state management systems are there in ASP.NET –

  • Client-side state management
  • Server-side state management

Q12. What are the key differences between function and stored procedure in .Net programming language?

Ans. The difference between function and stored procedure:

FunctionStored procedure
Returns only one valueReturns one or more than one value
Used in select statementsCannot be used in select statements
Has only input parameterHas both input and output parameters
It can’t handle exceptionsIt can handle exceptions using try-catch block

Q13. How would you retrieve user names for Windows Authentication?

Ans. User name for Windows Authentication can be retrieved by using –


Q14. Name the advantages of using Session State.

Ans. The advantages of Session State include –

  • Easy to implement
  • Stores user states and data across the application
  • Ensures data durability
  • Works in multi-process configuration, thereby ensuring platform scalability
  • Stores session object on the server. Keeping it secure and transparent from the user

Q15. What is HTTPhandler?

Ans. HttpHandler is a low-level request and response API in ASP.Net. It is used by the ASP.NET web application server to handle specific extension-based requests.

Q16. Name the methodology used to enforce garbage collection in .NET.

Ans. The methodology used to enforce garbage collection in .NET is System.GC.Collect().

Q17. How many types of indexes are there in .NET?

Ans. There are two types of indexes in .Net:

  1. Clustered index
  2. Non-clustered index

Q18. How many types of memories do exist in .Net?

Ans. There are two types of memories in .Net

  • Stack memory
  • Heap Memory

Q19. What is IL?

Ans. IL refers to Intermediate Language and is an object-oriented programming language to be used by the compilers. IL gets changed over to byte code when a virtual machine is being executed. IL is also known as Common Intermediate Language (CIL) or Microsoft Intermediate Language (MSIL).

Q19. What is inheritance? Explain its importance.

Ans. Inheritance is a crucial aspect of object-oriented programming that allows developers to create new classes that are built upon existing classes. This is achieved by reusing, extending, and modifying the behaviors defined in classes. The class whose members are inherited is the base class, while the class that inherits those members is called the derived class.

Q20. What is LINQ?

Ans. LINQ notices to Language Integrated Query. It was introduced with visual studio 2008 and is a uniform query syntax in C# and VB.NET for data retrieval from different sources and data manipulation irrespective of the data source.

Q21. Name different types of constructors in C#.

Ans. Different types of constructors in C# are –

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

Q22. Write the differences between Custom Control and User Control.


Custom Control User Control
Inherits from the System.Windows.Controls.Control classInherits from the system.Windows.Controls.UserControls class
Designed for single-application scenariosDesigned for multi-application scenarios
Introduces redundancy and maintenance problems if used on more than one applicationsCan be distributed without facing any problems associated with redundancy and maintenance
Loosely coupled control with respect to code and UITightly coupled control with respect to code and UI

Q23. What is Garbage Collector in .NET?

Ans. The garbage collector is responsible to free up the unused code objects in the memory. Every time a new object is created, the common language runtime allocates memory for the object.

Q24. What are the different events in the Page Life Cycle?

Ans. Different events in the Page Life Cycle include –

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

Q25. Name all the templates of the Repeater control.

Ans. Templates of the Repeater control are –

  • ItemTemplate
  • AlternatingItemTemplate
  • SeparatorTemplate
  • HeaderTemplate
  • FooterTemplate

Q26. What code we can use to send e-mail from an ASP.NET application?

Ans. We can write a given code to send an e-mail:

MailMessage mailMess = new MailMessage ();

mailMess.From = “naukri@gmail.com”;

mailMess.To = “shiksha@gmail.com”;

mailMess.Subject = “Test email”;

mailMess.Body = “Hi check this test mail.”;

SmtpMail.SmtpServer = “localhost”;

SmtpMail.Send (mailMess);

MailMessage and SmtpMail are classes defined System.Web.Mail namespace.

Q27. Explain Polymorphism?

Ans. Polymorphism is used as an interface with various functions. In this interface, a similar method or property can work on different actions depending on the run-time type of the instance.

Q28. Mention different types of Polymorphism?

Ans. Following are two types of Polymorphism:

  • Static or compile-time polymorphism
  • Dynamic or runtime polymorphism

Q29. Mention the design principles used in .NET?

Ans. In .Net, SOLID design principle is used, take a look at the following design principles:

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

Q30. Explain what is Marshaling in .Net?

Ans. Marshalling is defined as the process of transforming types in the managed and unmanaged code. It is the most important service given by CLR.

Q31. What are Boxing and Unboxing?

Ans. Boxing and Unboxing are defined as a concept of C#, where a unified view of the type system is enabled to treat the value of any type as an object.

Q32. Mention the divisions of the Memory Heap?

Ans. Following is the division of memory heap into three generations.

Generation 0 – Used to store short-lived objects. Quick Garbage Collection occurs in this Generation.

Generation 1 – Used for medium-lived objects.

Generation 2 – Used for long-lived objects.

Q33. How do we execute managed code?

Ans. To execute managed code, we can follow these steps:

  • Select a language compiler depending on the language of the code.
  • Convert the code into Intermediate language using its compiler.
  • The IL is then targeted to CLR which transforms the code into native code using JIT.
  • Execute Native code.

Q34. Mention the different parts of an Assembly?

Ans. Following are the different parts of an Assembly:

  • Manifest – Stores the information about the version of an assembly.
  • Type Metadata – Stores the binary information of the program.
  • MSIL – Microsoft Intermediate Language code.
  • Resources – List of related files.

Q35. List the advantages of Web Services?

Ans. Following are the advantages of Web Services:

  • It is stateless and firewall-friendly.
  • It is easy to create and supported by multiple platforms.
  • It can extend its interface and add new methods without affecting the client’s operations.

Q36. What is ADO (ActiveX Data Objects)?

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

Q37. List the fundamental objects in ADO.NET?

Ans. Following are the fundamental objects in ADO.NET:

  • DataReader- connected architecture
  • DataSet- disconnected architecture

Q38. What is a PE file?

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

Q39. What is the difference between DLL and EXE?

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

Q40. .NET is an OOP or an AOP framework?

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

Download PDF

In case you have recently completed a professional course/certification, then

Click here to submit your review and get FREE certification highlighter worth Rs. 500.

5.00 avg. rating (97% score) - 2 votes