Developed by Microsoft, dotNet or .NET framework is a software framework used by developers to build, deploy, and run applications that use .NET technologies such as desktop and web applications. According to a survey by Stack Overflow, the .NET framework is the most popular framework used by professional developers. Its popularity lies in the fact that it offers a highly consistent object-oriented programming environment for developers to build applications that can run on multiple platforms. If you are looking for a leg up in your software development career, this article on the top .NET interview questions will help you to brush up your knowledge before any interview.
Top .NET Interview Questions
1. What are the different components of the .NET framework?
The different components of the .NET framework are:
- Application Domain
- Common Language run-time
- .NET Class Library
- .NET Framework
- Common Type System
2. What do you mean by CTS?
CTS stands for Common Type System. It describes what data types are to be used in an application using certain rules such as which data type is to be declared or when it should be used in the program code. You can also make your own classes and functions by following the rules in the CTS. This is very useful when you want to call a data type declared in one programming language to another programming language.
3. Explain the differences between CLR and CLS.
CLR stands for Common Language Runtime and is one of the major components of the .NET framework. It can be used as a building block for various applications by providing a secure environment for executing them. When an application written in a programming language is compiled, the code is converted into an intermediate language. The code is then targeted to CLR which performs several operations on it like security checks, thread management, memory management, and loading assemblies.
CLS stands for Common Language Specification. It helps developers use components that are inter-language compatible with rules that come along with CLS. It also helps developers to reuse this code in other .NET compatible languages.
4. What do you mean by JIT?
JIT is a .NET framework compiler that stands for Just In Time. It is used during execution to convert the intermediate code into the native language.
5. What do you mean by Response.Redirect and Server.Transfer?
Response.Redirect is used to redirect the user’s browser to another page or site. The user’s browser history gets updated to reflect the new address. It also performs a round trip back to the client’s browser.
Server.Transfer is used to transfer from one page to another without making a round-trip back to the client’s browser. The user’s browser history does not get updated to reflect the new address.
6. Explain the differences between a class and an object.
The main differences between a class and an object are:
Definition of an object
Instance of a class
Describes methods, properties, etc.
Accesses the properties from the class
Template of an object
A class does not become an object unless instantiated
7. What is LINQ?
LINQ stands for Language Integrated Query. It was introduced with Visual Studio 2008 and bridges the gap between objects and data. It contains a set of features that extend query capabilities to allow data manipulation in the .NET framework language syntax irrespective of the data source.
8. What is a garbage collector?
A garbage collector is used to free unused code objects in the memory head. The memory head is divided into 3 generations:
- Generation 0 - Stores short-lived objects.
- Generation 1 - Stores medium-lived objects.
- Generation 2 - Stores long-lived objects.
9. Define caching and its various types.
Caching means temporarily storing data in the memory so that it can be accessed from the memory instead of the original location. This increases the speed and efficiency of the application. The different types of caching are-
- Data caching
- Page caching
- Fragment caching
10. What do you mean by MVC?
MVC stands for Model View Controller. It is an architecture used to build .NET applications.
Model - Handles object storage and retrieval from databases.
View - Handles the UI of an application.
Controller - Handles user interactions and renders the view that is required for the user interaction.
11. Explain role-based security.
Role-based security is used to implement security measures and authorize access to users based on their roles in the organization. For example, Windows has role-based security access like admin, user, and guest.
12. What is cross-page posting?
Whenever you click on the submit button on a page, that data will be stored on the same page. However, if the data gets stored on a different page, it is known as cross-page posting. It can be achieved using the POSTBACK URL property.
13. List all the templates of the Repeater control.
The different templates of the Repeater control are:
14. What is MIME?
MIME stands for Multipurpose Internet Mail Extensions which enables users to exchange files over the internet. The MIME header is inserted onto servers at the beginning of the web transmission. The clients can then use this header to select an appropriate ‘player’ for the data type indicated by the header.
15. What is a delegate in .NET?
A delegate in .NET works similarly to a function pointer in programming languages such as C or C++. It can also be used to create a custom event in a class.
16. What is the application domain?
.NET framework introduces the concept of application domain or AppDomain which is a lightweight process that can serve either as a container or a boundary. The .NET CLR uses it as a container for data and code and allows multiple .NET applications to run in a single AppDomain.
17. What is CAS?
CAS stands for Code Access Security that prevents unauthorized access to resources. It enables users to set permissions for their code. The code is then executed by the CLR depending upon the permissions.
18. How do you prevent a class from being inherited?
You can prevent a class from being inherited by using sealed keywords.
19. What are the different types of assemblies available in the .NET framework?
There are two types of assemblies available in the .NET framework:
- Private Assembly - It is installed in the directory of the application and is accessible only to the application.
- Shared Assembly - It is installed in the GAC and can be shared by multiple applications.
20. What are MDI and SDI?
MDI stands for Multiple Document Interface. It lets you open multiple windows - one parent window and multiple child windows. The components of the child windows are shared from the parent window.
SDI stands for Single Document Interface. It lets you open a separate window for each document. Each window has its own components and is not constrained to the parent window.
Are you a web developer or interested in building a website? Enroll for the Full Stack Web Developer - MEAN Stack Master's Program. Explore the course preview!
Want to Learn More?
This article contains the top frequently asked .NET interview questions commonly asked during an interview. If you want to learn more, you can check out Simplilearn’s .NET Programming Certification Course which contains all the fundamentals of .NET programming. You will learn how to create .NET projects and coding with C#, including Visual Studio and WinForms. Sign up for this course today to boost your career in software development.