.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 .net interview questions, which will help you to succeed in a .NET interview.
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 conversion||Explicit conversion|
|Object type refers to the value type||Retrieve 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.NET||Active Server Pages (ASP)|
|Creates dynamic web applications||Creates web pages|
|Uses ADO.NET||Uses ADO|
|Completely object-oriented||Partially 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:
|Returns only one value||Returns one or more than one value|
|Used in select statements||Cannot be used in select statements|
|Has only input parameter||Has both input and output parameters|
|It can’t handle exceptions||It 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:
- Clustered index
- 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. Cite the differences between Custom Control and User Control.
|Custom Control||User Control|
|Inherits from the System.Windows.Controls.Control class||Inherits from the system.Windows.Controls.UserControls class|
|Designed for single-application scenarios||Designed for multi-application scenarios|
|Introduces redundancy and maintenance problems if used on more than one applications||Can be distributed without facing any problems associated with redundancy and maintenance|
|Loosely coupled control with respect to code and UI||Tightly 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 –
Q25. Name all the templates of the Repeater control.
Ans. Templates of the Repeater control are –