.Net is one of the most widely used frameworks for developing applications on windows, so we know hiring Dot NET developers is not easy. It encompasses ASP .Net and languages such as VB .Net, C#, Cobol, Perl, and more. Designed by Microsoft and its community, this open-source framework effortlessly combines MVC structure and Web API into a powerful tool and enables developers to create reliable and responsive websites.
As an interviewer hiring for .Net developers, there are hundreds of Dot NET interview questions that you could ask to determine a candidate’s fit for .NET related position. The key characteristics of a good candidate include a high skill level and an in-depth understanding of various essential and advanced development concepts.
The .Net interview questions listed below give a good primer for screening candidates working in the .NET framework. That being said, it is important to remember that this list will just get you started. Depending on the specific job offer and related tasks, you can identify and ask the best Dot Net interview questions and answers.
For the ease of taking interviews, we are segregating them into 3 different categories as
Let's get started then.
1. What is .Net Framework?
.NET is a software framework developed by Microsoft for Windows-based applications. The framework can also be used for developing web and mobile-based applications. It is a comprehensive system of libraries, APIs (application programming interface), and classes that support the seamless building and deployment of applications. It also offers the flexibility to conveniently write codes across several programming languages.
2. Which are the languages supported by .NET at present?
When .NET was first introduced, it supported several languages such as C#, VB.NET, COBOL, Perl, etc. At present, .NET supports almost 44 different languages.
3. How .NET can support so many languages?
.NET can support so many languages because the .NET language code is compiled to Microsoft Intermediate Language (MSIL). The generated code, as a result, is a powerful code that runs in a .NET environment. After compilation, the languages do not remain a barrier and the code can call or use functions of various other languages too.
4. What is MSIL?
MSIL refers to the Microsoft Intermediate Language, which provides instructions for memory handling, calling methods, handling exceptions, storing values, and more.
5. Describe the essential components of .Net?
Among the important components of .Net include .Net Class library, application domain, Common Type System, .Net framework, Profiling, and more. Among these, the Class Library and the Common Language Runtime is the most important one.
The Class Library consists of a set of different classes used to access common functionality that can be shared among different applications. In contrast, CLR offers building blocks for a wide variety of applications.
6. Explain the concept of CLR in detail?
CLR in .Net stands for Common Language Runtime. It is one of the main components of the .Net framework and provides building blocks for a wide array of applications. When an application is built using C#, it usually gets compiled by its own compiler followed by converting into an Intermediate language.
This is then targeted to CLR, which does multiple operations such as security checks, memory management, thread management, and assemblies to be loaded. Overall, CLR offers a secure execution environment for applications.
7. What do you understand by CTS in .Net?
CTS in .Net stands for Common Type System. It has a set of pre-defined rules which state how a specific data type should be declared, defined, and used in the program. It also describes the data types that are to be used in the application.
8. What is JIT stand for in .NET?
JIT in .NET stands for Just in Time. It is essentially a compiler that is used to convert intermediate code into native code easily. During execution in .NET, the code is converted into the native language, known as the byte code. The CPU processes this, and the .NET framework assists with the conversion.
9. Explain the difference between namespace and assembly?
While namespace in .Net groups asses, assembly refers to a physical grouping of logical units. Apart from this, a namespace can span multiple assemblies as well.
10. What is the difference between a class and an object?
While class is the definition of an object, an object is an instance of a class. The class can be looked at as a template of the object that describes all the methods, properties, states, and behaviors that the implementing object will have.
Whereas an object is an instance of a class, and until instantiated a class does not become an object. There can be various instances of objects based on one class, each with different properties.
11. What is the difference between the Stack and the Heap?
The stack keeps track of mainly two things- where the executing thread is and what is executing as each thread has its own Stack.
The Heap, on the other contrary, is majorly responsible for keeping track of the data, or more precise object. Also, the Stack stores value types (types inherited from System.ValueType), whereas the Heap stores reference types (types inherited from System. Object).
12. Briefly explain the process of boxing and unboxing in .Net?
Boxing in .Net is a process of converting value type into a reference type.
E.g. int x = 1;
object obj = x ;
Whereas unboxing refers to a process of converting reference type to value type.
E.g. int y = (int)obj;
13. What do you understand by MVC?
MVC or Model-View-Controller is primarily a framework used to develop web applications. The web application base builds on the Model-View-Controller pattern which then separates the application logic from UI. TThe Controller controls the input and events from the user.
14. Name the different validators in ASP.NET?
Among the different validators in .Net include range validator, required field validator, custom validator, compare validator, regular expression validator, and summary validator.
15. What is CLS in ASP.NET?
CLS in .Net stands for Common Language Specification. It is basically put into place to ensure that the application developer is fully capable of inter-language operations as and when required. It is a reusable aspect across all of the .NET compatible languages.
16. What do you understand by the assembly in .NET?
An assembly in .Net refers to a collection of all of the logical units present. These logical units are nothing but the entities that are required to build an application followed by deploying the same using the .NET framework. There are four
key components of an assembly including
17. What is serialization?
Serialization in .Net refers to the process of converting an object into a stream of bytes. On the other hand, deserialization is the opposite process of serialization, i.e. creating an object from a stream of bytes. These are mostly used to transport objects or to persist objects.
18. What is state management in ASP.NET?
State management is a specialized technique used to manage a state of an object on different requests. It is essential to manage the state of any web application. Client-side state management and server-side state management are the two types of state management systems in .NET.
19. Explain manifest in .NET Framework?
Manifest in .NET is mainly used to store assembly metadata. It contains all the metadata which is necessary for security identity, version of the assembly, the scope of the assembly, and resolving references to classes and resources.
20. What is a delegate in .NET?
Delegate in .NET is very similar to a function pointer in C or C++ programming language. It allows the programmer to easily encapsulate a reference to a method inside a delegate object.
21. Explain CAS or Code Access Security in the .NET framework.
CAS or Code Access Security is a part of .NET security. The key objective of .NET security model is to prevent any kind of unauthorized access as well as put restrictions on the codes to perform specific tasks.
22. Define LINQ in .Net
LINQ in .Net stands for Language-Integrated Query, which is a Microsoft programming model and methodology that offers developers an excellent way to manipulate data using a concise yet expressive syntax. It is part of the C# programming language and can be imported as a library in other languages. LINQ does this by instilling Microsoft .Net-based programming languages with the ability to make formal queries.
23. What do you understand by BCL?
BCL is primarily a base class library of classes, interfaces, and value types. It forms the foundation of .NET framework applications, controls, and components. BCL encapsulates a wide range of common functions and makes them easily available for developers.
24. Explain CLS in .Net.
CLS or Common language specification in .Net allows the developers to use the inter-language compatible components that are with certain rules and come with CLS and also helps in reusing the code in different .NET compatible languages.
25. What are MDI and SDI?
MDI or Multiple Document Interface lets you open multiple windows and will have one main window and an equal number of smaller windows. The components are usually shared from the main window, such as a toolbar, menubar, etc. SDI or Single Document Interface, on the contrary, opens each document in a separate window.
Also, each window has its own components such as menubar, toolbar, etc., and is not constrained to the parent window.
26. What is garbage collection?
Garbage collection in .Net is primarily a heap-management strategy where a run-time component manages the lifetime of the memory used by objects completely.
27. Explain caching.
Caching refers to storing the data temporarily in the memory so that it can be accessed from the memory instead of having to search for it in the original location. Caching enhances the efficiency of the application and increases its speed. There are mainly three types of caching including page caching, fragment caching, and data caching.
28. What do you mean by application domain?
Application domain or AppDomain is an important concept of .Net. It is like a lightweight process that acts like both a container and a boundary. The .Net run-time uses the AppDomain as a container for both code and data. The CLR usually allows multiple .NET applications to run in a single AppDomain.
29. Explain OOP and how is it related to the .NET Framework?
OOP stands for Object-Oriented Programming. It is basically a programming structure that makes use of self-contained entities called ‘objects’ in place of methods to achieve the desired functionality. OOP also allows .NET developers to build modular programs and classes containing properties, fields, methods, events, and other logical modules. Among the basic features of OOP are encapsulation, polymorphism, abstraction, and inheritance.
30. What is FCL in .Net?
FCL in ASP.Net stands for Framework Class Library. It is a collection of reusable types, including interfaces, classes, and data types included in the .NET Framework. Its main use is for developing a wide variety of applications, as it offers access to system functionality.
31. What is the difference between value type and reference type.
Types in .NET Framework are of two types- Value Type or Reference Type. While a Value Type is stored in the stack and keeps the data within its own memory allocation, Reference Type, on the other hand, is stored in the heap and contains a pointer to a different memory location that holds the actual data.
32. Explain the difference between Stack and Queue?
In .Net, the values in a stack are processed via the LIFO (Last-In, First-Out) principles. Therefore, all the elements are inserted and deleted from the top end. However, a queue lists items on a FIFO (First-In, first-out) basis both in terms of insertion and deletion. The elements are generally inserted from the rear end in a queue and deleted from the front end.
33. What do you understand by managed extensibility framework?
Managed extensibility framework (MEF) in .Net is the name of a new library introduced as a part of .NET 4.0. The main aim of this library is to help extend an application by offering greater reuse of applications and components.
34. Explain the meaning of object pooling?
Object pooling in .Net refers to the concept of storing a group of objects/pools in memory that we can reuse later as and when needed. Whenever there is a requirement for a new object to create, an object from the pool can be allocated for this request. It helps in minimizing object creation.
35. What is managed code in .Net, and how does it differ from unmanaged code?
A managed code in.Net is primarily the one that runs in a managed runtime environment. For instance, a code executed by the CLR in the .NET framework is an example of managed code. A managed runtime environment in .Net manages and executes a code automatically by offering various services such as exception handling, garbage collection, and memory allocation.
On the contrary, an unmanaged code typically runs in an independent environment, where an operating system directly
executes it without any interference from the CLR or JIT.
36. What is the key difference between Responses. Redirect and Server.Transfer methods in .Net?
While both of these methods have almost the same function of taking users from one web page to another web page, there is a difference between the two in the way they achieve this objective. Response. Redirect takes a user from one web page to another via redirecting the browser, thus registering the web address in the user's browser history.
On the contrary, the Server. Transfer method ends the current web page and opens the fresh web page, thus not going back to the user's browser.
37. Describe the process of garbage collection?
Garbage collection is one of the most essential functions of the CLR that has the garbage collector allocating and releasing memory for an application automatically. As soon as CLR initializes the garbage collector, it allocates memory for the objects, known as managed heap. The managed heap is typically organized into three generations, known as 0, 1, and 2. Since generation 0 is for short-lived objects, the garbage collector releases the code objects in this heap more often as compared to Generations 1 and 2.
The first thing that garbage collector does is identifying the live objects followed by updating the references for compacting those objects. Lastly, it releases the space used by the dead code objects and sends the remaining code to an older segment.
38. What is the difference between the while and for a loop. Also, provide a .NET syntax for both loops.
Both while and for loops are used whenever a unit of code needs to execute repeatedly, however, there is a key difference. While in the case of for loop, the number of times needed to reiterate the code is known, the while loop is used when you are required to repeat something until a given statement is true.
The syntax of the while loop in .NET is:
While condition [is True]' statements
End While The syntax of the for loop in .NET is:
For counter [ As datatype ] = start To end [ Step step ]' statements Next [ counter ]
39. Explain EXE and DLL modules.
EXE and DLL are assembly executable modules. While EXE is an executable file that runs the application, DLL stands for dynamic link library that is used for storing hidden codes. In the case of EXE files, the system automatically generates them when we build an application and we cannot share an EXE file with other applications. On the other hand, an application can have multiple DLLs and we can also share DLLs with other applications.
40. What do you understand by cross-page posting?
Cross-page posting refers to a useful property in .Net that enables easy posting of data from one page to another without reloading the current page. Upon clicking on a button, by default, it reloads the same page.
For instance, if you click on the submit button, it stores the data on the same page that hosts the button. However, if you want to store the data on a different page, you need to use cross-page posting on your project.
41. Explain role-based security in .Net.
Role-based security in .Net is used to implement robust security measures based on the role assigned to the users in the organization. Users can then be authorized based on their roles in the organization. For instance, windows have role-based access such as administrators, users, and guests.
42. What do you mean by passport authentication?
Passport authentication is a process of first checking the passport authentication cookie. In case the cookie is not available, the application redirects to the passport sign on-page. Passport service then authenticates the user details on the sign-in page and sees if they are valid, stores them on the client machine, followed by redirecting the user to the requested page.
43. What is a tuple?
Tuples refer to the collections of the same or different types of data. The size of tuples is always fixed (1 - 8) and the developer must apply the size that they want at declaration time.
44. Explain different types of cookies in .NET?
There are mainly two types of cookies in .NET. One is a session cookie that resides on the client machine for a single session till the time the user logs out. The other is a persistent cookie that resides on the user machine for a specified period fixed for its expiry, which could be an hour, week, or a month.
45. What do you mean by MIME?
MIME stands for Multipurpose Internet Mail Extensions, an extension of the e-mail protocol that allows users to use the protocol to easily exchange files over the internet. Servers typically insert the MIME header at the beginning of the web transmission. Clients then use this header to select an appropriate ‘player’ for the type of data that the header indicates.
46. How can you manage pagination on a page using .Net?
.Net gives you an option of using the pagination option in DataGrid control. To do this, you have to set the number of records for a page, and it will take care of pagination by itself automatically.
47. Explain HTTP Handler
This is another common dot net developer interview question. Here you need to explain that an HTTP handler is a specialized component that handles every request into an ASP.NET application. It is one of the most important components for handling ASP.NET application requests. It uses various handlers to serve different files.
Among some of the default HTTP handlers for .NET include
48. Explain the concept of globalization and localization.
Globalization here refers to the process of customizing applications that support multiple cultures and regions. At the same time, localization is the process of customizing applications that support a specific culture and region.
49. Can you explain the difference between Task and Thread in .NET?
Thread in .Net basically represents an actual OS-level thread that has its own stack and kernel resources. It allows the highest degree of control, where you can either Suspend() Abort()or Resume() a thread, observe its state, and can also set thread-level properties such as apartment state, stack size, or culture. Unlike the ThreadPool, a task, however, does not create its own OS thread. Instead, tasks are executed by a TaskSchedulerwhich is a default scheduler that simply runs on the ThreadPool.
50. Explain why you can specify the accessibility modifier for methods inside the Interface?
In an interface, there are virtual methods that do not have a method definition. All the methods there need to be overridden in the derived class. This is the reason why they all are public. There is no doubt that as an interviewer you want to hire the best developer you can find during dot net interviews.
However, remember that you also need to hire a candidate who will fit well within your existing .NET team. Make sure to ask the right Dot Net interview questions and answers and use various best practices for hiring, to be able to hire a professionally qualified and leading .Net developer with the right mindset and required skills that fully complement your existing team’s capabilities.
Moving ahead, if you are looking for an easier way to assess the candidate's skills, use reliable AI-powered online skills assessment software - iMocha for .NET skills. It will help you screen candidates for you and save you a lot of time (that you would otherwise spend on telephonic interviews of so many non-competent candidates). Check out a few of iMocha's latest & quality .Net & C# online tests below -
iMocha is super easy to use and provides a good candidate experience as well.
You can also check out the pre-employment aptitude test which can also give a good idea about the candidate's attitude.
To know more about iMocha, schedule a free demo now!