.NET is a computer framework used by developers to build various kinds of applications. It is open-source software created by Microsoft, which is free and can be used in multiple languages. It easily and quickly develops high-quality software and applications. Developers find it one of the most productive developer platforms for building web applications for mobile, PC, desktop, etc.
Developers are highly interested in this software framework as it is very innovative and can be used to target any application. Various types of applications are written with .NET in different languages. The developers highly seek these skills in new candidates. This article provides you with the top 50 .NET interview questions and answers to help you prepare for the interview and help to brush up on your knowledge about the open-source developer framework. The .NET interview answers will help you better answer the .NET interview questions and what the interviewer is looking for in a response from you. Various .NET training institutes provide you multiple courses and certificate programs for learning the .NET framework. These institutes help you understand the concepts of this open-source software loved by the developers so that you can ace the interview and answer all the frequently asked .NET interview questions.
.NET Interview answers:
Along with the top 50 .NET interview questions, this article will provide answers to the most frequently asked questions in the interview process that will help freshers and all the experienced candidates to help better prepare for the job interview. This article contains all the basic questions and some advanced questions that the interviewer might ask from the candidate to check the knowledge regarding the .NET application skills. The answers given should reflect the concept and understanding of the individual regarding the developer software and how the framework functions. The .NET interview questions are mainly asked to check whether the candidate knows the implementation of the software or not.
There are various institutes online as well as offline that provide training for .NET programming. It is one of the most sought out careers in the programming field. Developers highly prefer .NET because of its versatility and easy implementation. Different software training institutes offer various certificate courses for candidates and prepare the aspirants for various .NET interview questions.
These training programs do not require any pre-requisite and provide all the important and basic points to help the students better understand the concept of .NET programming. Some training institutes prepare you thoroughly by giving practical and application based knowledge. These training programs help you better prepare for the .NET interview questions. The .NET program is easy to learn. Once the candidate learns the programming, it becomes easier to and faster for the developers to build different applications with ease. This .NET training helps the individual to understand the ways with which software is developed for windows and the basic components of .NET. The programs help you to develop not only secure but also scalable applications using .NET. There are various languages with the help of which .NET applications are written. These include C#, F# and visual basics which are also covered in the training programs. They also prepare you for all the .NET interview questions that the interviewer might ask during the interview.
Frequently asked .NET questions:
.NET interview questions test the basic understanding and concept of the developers regarding the .NET framework and its applications. This article includes all the frequently asked .NET interview questions from basic to the advanced level. It also contains the answers to the questions which will help you revise your concept of .NET software framework and help you to prepare better for your interview. The .NET interview questions are provided category wise starting from the beginner level. It includes all the basic .NET interview questions that are asked to a fresher. Then the article includes some intermediate level questions which are a bit more difficult than the beginner level questions. At last there are the advanced level .NET interview questions that are asked in the interview to the experienced developers. These questions of all levels help the candidate better prepare for the interview.
.NET interview questions for freshers
1. What do you know about .NET?
.NET is an open source and free, cross-platform software framework that is used to run and build different kinds of applications. It is created by Microsoft and it runs on windows. It is also used to deploy and debug code on various applications that run on .NET technology by using several tools such as libraries, API etc.
2. What are the different languages that are supported with .NET?
Applications are written with .NET in several languages such as-
- C# which is a simple and modern language. This programming language is a type-safe language and is object oriented thus used with .NET easily.
- F# which helps to write code in a compact and easy way.
- Visual Basic is an approachable language and is used with .NET to build type-safe applications.
3. Tell me about different components of .NET framework
.NET has several components which are as follows:
- .NET class library
- Common language run-time
- Application domain
- Common type system
- .NET framework
Out of all these components, .NET class library and common language run-time are the most important components of .NET framework. These help in easy execution of the development process and proper implementation of complicated functions that are used by the application of .NET framework.
4. What is meant by CTS?
CTS is an abbreviation for Common Type System. It is a component of .NET framework. CTS follow particular rules. According to these structured rules any data type is declared and is used in a program code. It is possible to create one’s own classes and functions as well by abiding by the rules in the CTS.
5. What do you understand from CLS?
CLS stands for Common Language Specification. It comes with a certain set of rules. It helps to use and reuse the codes that are inter-language compatible. With the help of common language specification, all types of codes can be reused among all the languages that are compatible with the .NET framework.
6. What are managed codes?
These are the codes that CLR or Common Language Run-Time manages. It is useful in managing memory with the help of garbage collection. The execution of managed codes is done using .Net framework and is necessary for its implementation.
7. What are unmanaged codes?
These are all the codes that are not managed by the common language runtime or the CLR. It is independent of the .NET framework. Since the common language runtime does not handle it, the execution and management of memory are done independently.
8. What do you understand about ASP.NET?
ASP.NET is a framework that Microsoft develops, and it is the replacement of ASP or the Microsoft Active Server Pages. This framework is prevalent and is used by developers to build various new generation websites. These websites are developed using different web forms such as MVC, Java, etc.
9. What is the difference between ASP.NET and ASP?
ASP.NET is the successor of ASP. The difference between ASP.NET and ASP is as follows:
|.NET languages||Certain .NET languages which are compiled to MSIL are used by ASP.NET. MSIL stands for Microsoft Intermediate Language. The languages compiled here are C# and VB.NET.||ASP only uses Visual Basic. The interpretation of the ASP code is done during its execution itself.|
|Object orientation||ASP.NET is fully object-oriented.||ASP is partially object-oriented.|
|XML support||ASP.NET has built-in and full XML support. This support makes the data exchange very easy while using ASP.NET.||ASP does not have any built-in support for XML.|
|Technology||The technology used by ASP.NET to connect and to work with the database is ADO.NET||ASP uses ADO technology to work.|
|Uses||Developers use ASP.NET to create web applications.||ASP is a server-side technology of Microsoft. It is used to create web pages instead of applications.|
10. How many types of assembly are there in .NET?
There are mainly two types of assembly in .NET framework. These are:
- Private assembly
- Shared or public assembly
11. Explain private assembly.
A Private assembly is the type of assembly that is accessible to the application only. It cannot be accessed from a different folder. To use this assembly on a particular folder, you need to copy the private assembly in that folder, then only it can be accessed. It is necessary to install this assembly in the installation directory of the application in order to be accessible.
12. Explain public assembly.
Public assembly is also known as a shared assembly. This type of assembly is not application-specific and can be accessed and shared by multiple applications. Unlike private assembly, it is only required to store the shared assembly at the system level, and there is no need to copy it to every folder that we need to work on with this assembly. It can be shared with multiple applications. Shared or private assembly is stored and installed in the GAC, which stands for Global Assembly Cache.
13. Tell us the key difference between assembly and namespace.
The key difference between an assembly and a namespace is that an assembly is for the physical assembling of the logical units used in .NET framework while a namespace is used to assemble classes.
14. What is MVC?
MVC is an architecture that developers use to create .NET applications. There are three components of MVC. These include:
- Model: Its function is to hold the data and check the logic of the data. This part of the MVC handles the object’s storage, and it is useful in retrieval from the database for any application.
- View: The UI part of any application is handled by this component of MVC. They receive the information to be displayed from the models and then view them to the developer.
- Controller: This component of the MVC is used to handle the user interaction.
15. Explain caching. How many types of caching are there?
Storing of the data temporarily such that it is easily accessed later from the memory where it has been stored is known as caching. This accessibility is done with the help of an application. Caching helps to improve the speed of any application. It also increases the efficiency of performance of the application.
There are mainly three types of caching which are:
- Page caching
- Data caching
- Fragment caching
16. What is the use of a garbage collector?
The use of garbage collector in the .NET framework is to free the memory from all the unused codes. It checks the generation of memory heap and clears it of all the unused codes and free some memory space. There are basically three generations in which the memory heap is divided. These are:
- Generation 0: This generation is for holding only short-lived objects.
- Generation 1: This generation holds medium life objects.
- Generation 2: This generation is for long-lived objects.
.NET interview Questions for experienced
1. What do you mean by assembly in .NET? What are its different parts?
An assembly is a compilation of codes and logical units of codes. It is a type of file generated automatically. It contains the combination of resources which are built together to form logical units and to check its functionality. The different parts of an assembly are:
- Type metadata
2. What is MDI?
MDI, also known as multiple document interface, enables the user to open multiple windows. There is one parent window and several child windows. The components can be shared from the parent window and to the child windows. The child windows do not have their own components.
3. What is SDI?
SDI is called Single Document Interface. Unlike MDI, it only opens a single document in one window. There is no parent window and each window has its own components.
4. Name the various constructors in C#
There are mainly five types of constructors in C#. These are:
- Default constructor
- Copy constructor
- Static constructor
- Private constructor
- Parameterized constructor
5. How many types of memory are supported in .NET? Explain.
Mainly two types of memory are supported in .NET framework. These include:
- Stack: This type of memory present in the .NET framework functions as a tracker of each execution thread. It tracks their location as well.
- Heap: This is also a tracker but the primary difference between a stack and heap is that heap keeps track of more precise objects and data than stack.
6. What is localization?
Localization is a process by which the applications used globally are changed and customized to be easy to access in a specific language or by a particular culture. In addition, they are altered to meet the criteria of a particular culture and locale.
7. What do you mean by globalization?
When the applications are designed so that users and developers can use them from all around the world in various languages, it is called the globalization of the application.
8. Give differences between an abstract class and an interface in .NET
|Supported access modifier||All types of access modifiers are supported||Only public access modifier|
|Static Members||Contains static members||No static members|
|Multiple inheritance||Cannot be achieved||Can be achieved|
|Uses||Properties, methods and fields are declared with the help of abstract class.||Interface cannot declare fields.|
9. What is manifest?
Manifest in the .NET framework contains metadata that is useful in identifying security, gathering information about the assembly version, and referencing the validations to classes.
10. Explain the key difference between a class and an object.
A class is a template of an object that is used to describe all methods and the properties of an application but it cannot become an object without instantiation.
11. What is Response.Redirect?
Response.Redirect mainly performs a trip back to the browser of the client and redirects them to the new browser when the user changes or redirects to another page or site. The history of the user is also updated.
12. What is Server.Transfer?
Server.Transfer, unlike Response.Redirect, only transfers the user from one page to another. There is no trip back to the browser of the client.
13. Are there any validators in ASP.NET?
Yes, there are two types of validators in ASP.NET. They are as follows:
- Client side validation
- Server side validation
14. What is custom control?
Custom control is a dynamic layout that defines a single control. It has complete toolbox support and is derived from control.
15. What is user control?
User control has a static layout and is derived from UserControl.
16. What is known as CAS in .NET?
Stands for Code Access Security in .NET is for securing the programs and resources. It denies access that is unauthorized to them and enables users to give permissions to use the resources.
17. What do you understand by value type?
Value type is something in .NET that stores the data directly in the stack memory.
18. What is meant by reference type?
A reference type contains the pointer to the address of the data, and the memory is stored in a heap by this type.
Advanced .NET interview questions:
1. What is EXE?
EXE stands for an executable file. Whenever an application is built, an EXE file is generated that only runs the application for which it is designed.
2. What is DLL?
Dynamic Link Library or DLL is a library that contains hidden codes. An application can have several DLLs.
3. What do you understand by function?
Function in .NET has only an input parameter and returns a single value only.
4. What is the meaning of stored procedure in .NET?
Stored procedure in .NET has both the input as well as the output parameters. The Stored procedure is required to perform a specific task only.
5. How many events are there in the page life cycle?
There are a total of eight events in a page life cycle. It includes:
- Page PreInit
- Page Init
- Page InitComplete
- Page PreLoad
- Page Load
- Page LoadComplete
- Page PreRender
6. What is role-based security?
The purpose of Role-based security in .NET is to provide security measures according to the roles that are assigned to the users.
7. Explain MIME
Multipurpose Internet Mail Extension or MIME is an e-mail protocol extension. The purpose of MIME is to simplify the exchange of files over emails.
8. Tell us about HTTP handler
HTTP handler is a component that handles all the application requests of ASP.NET. There are different handlers in the HTTP handler that serve specific files.
9. For ASP.NET, What are the default HTTP handlers?
There are four default HTTP handlers. These are:
- Page handler
- handler for User Control
- Web Service handler
- Trace handler
10. What is executescalar?
ExecuteScalar is used in .NET to obtain only a single value that is the output value.
11. What is executenonquery?
ExecuteOnQuery is used in the .NET framework for execution, insertion and updating the statements.
12. What are session cookies?
The cookies that are present on the client machine and are only for a single session are called session cookies.
13. What do you mean by persistent cookies?
The cookies that are present on the user machine until its expiry are called persistent cookies.
14. What do you understand about ViewState?
The purpose of ViewState in the .NET framework is to retain server-side objects.
15. What are strong typing and weak typing?
The data variable types are checked at the time of compilation in strong typing. In weak tying, the variables of the data are checked during run-time.
16. List the namespace used to create a localized application
The namespace necessary to build a localized application are system.globalization and system.resources.
These 50 most frequently asked .NET interview questions will help you to prepare and ace the interview. The developers highly love .NET, and its scope is vast. It is a productive and modern open-source framework that allows you to work on a platform. The .NET interview questions have covered most questions to brush up on your concept and make you confident for the interview.