Categories
Top 50 Dot Net Interview Questions and Answers
The rise in the number of job openings leads to a lot of vacancies and stiff competition to hire the most proficient .NET developers. With these questions, you will gain in-depth knowledge and insight into how to answer the most asked questions in a .NET interview. This guide has been carefully curated, considering many factors and including expert advice from multiple professionals and .NET experts.
1. What is .NET framework?
The ability to develop classes, libraries, and APIs and run, debug, and deploy code onto web services and applications form are the key uses of this framework. It supports a lot of languages, and you can work with everything from C# to VB all the way to Perl, and more.
The object-oriented model is championed here in the .NET framework
2. What is the meaning of state management in .NET?
There are two types of state management:
Client-side:
It is used to store information on the client’s machine and is formed mostly of reusable and simple objects.Server-side:
It stores the information on the server and makes it easier to manage and preserve the information on the server.3. How does managed code execute in the .NET framework?
1) Choosing a compiler that can execute the code written by a user
2) Conversion of the code into Intermediate Language (IL) using a compiler
3) IL gets pushed to CLR, which converts it into native code using JIT
4) Native code is now executed using the .NET runtime
4. What does CLR stand for in .NET?
If a user writes an application in C#, it gets compiled and converted to intermediate code. After this, CLR takes up the code and works on it with respect to the following aspects:
1) Memory management
2) Security protocols
3) Libraries for loading
4) Thread management
5. What is CLS?
6. What is CTS?
However, you can build your own calls using the rules given by CTS. CTS is mainly provided to cover the variety of languages you can use when working with the .NET framework.
7. What is the meaning of MSIL?
8. What does JIT stand for in .NET?
In .NET, during execution, the code is converted into the native language, also called the byte code. This is processed by the CPU, and the framework helps with the conversion.
9. What are some of the common components of .NET?
1) .NET Class Library
2) .NET Framework
3) Language Runtime
4) Application Domain
5) Profiling
10. What is the difference between managed code and unmanaged code in .NET?
Managed Code | Unmanaged Code |
Managed by CLR | Not managed by any entity |
Garbage collection is used to manage memory | Runtime environment takes care of the management |
The .NET framework is necessary for the execution | Not dependant on the .NET framework to run |
11. Is it possible to manually set a timeout for a session in .NET?
12. What are some of the advantages of using a session?
There are numerous advantages of making use of a session are as mentioned below:
1) It is used to store user data across the span of an application. 2)It is very easy to implement and store any sort of object in the program. 3) Individual entities of user data can be stored separately if required. 4) The session is secure, and objects get stored on the runtime server.13. What are the constructor types present in C# .NET?
1) Copy constructor
2) Default constructor
3) Parameterized constructor
4) Private constructor
5) Static constructor
14. What is the meaning of caching?
There are three types of caching:
1) Data caching
2) Page caching
3) Fragment caching
15. What are some of the components of an assembly in .NET?
Resource:
A collection of related filesMSIL:
The Intermediate Language codeMetadata:
The binary data of a programManifest:
A collection of information about the assembly16. What is an assembly in .NET?
17. What is the meaning of LINQ?
18. What is the difference between an object and a class in .NET?
Object | Class |
An instance of a class | The template for creating an object |
A class becomes an object after instantiation | The basic scaffolding of an object |
Used to access properties from a class | The description of methods and properties |
19. What is the difference between system.stringbuilder and system.string in .NET?
system.stringbuilder | system.string |
Mutable | Immutable |
Supports using append | Cannot use the append keyword |
20. What is the difference between a function and a stored procedure in .NET?
Function | Stored Procedure |
Can only return one value | Can return any number of values |
No support for exception handling using try-catch blocks | Supports the usage of try-catch blocks for exception handling |
The argument consists of only one input parameter | Both input and output parameters are present |
A function can be called from a stored procedure | The stored procedure cannot be called from a function |
Intermediate Interview Questions and Answers
21. What is the use of delegation in .NET?
A delegate object can be easily passed to a program after this, and then a method, which was referenced earlier, can be called. Custom events can also be created in the class using a delegate.
22. What are the types of memories supported in the .NET framework?
Stack
Used for static memory allocationHeap:
Used for dynamic memory allocation23. What is MVC?
MVC consists of three entities as the name suggests:
Model:
Used to store and pull back data from a databaseView:
Used to display the contents of an applicationControllers:
Entities that handle user interaction24. What are the three generations of garbage collection in .NET?
Gen 0:
Stores short-lived objectsGen 1:
Objects moved from Gen 0 live hereGen 2:
Stores long-lived objects and Gen 1 objects25. What is the use of GAC in .NET?
26. What is the meaning of garbage collection?
An entity called the garbage collector is used to allocate and de-allocate memory as and when required by an application. This is done by performing checks on the references of variables and objects used by the application. If an object is no longer required by the application, the memory is de-allocated and freed up.
27. What is the meaning of CAS in .NET?
28. What are memory-mapped files used for in .NET?
The MemoryMappedFile.CreateFromFiles() function is used to obtain a memory-mapped file object easily.
29. What is the use of manifest in the .NET framework?
1) Assembly version information
2) Security identification
3) Scope checking of the assembly
4) Reference validation of classes
30. What is the meaning of boxing and unboxing in .NET?
Unboxing is the opposite of boxing, where the reference type is converted back into a value type.
31. What are the requirements needed for connection pooling?
1) The presence of an identical connection string for both entities
2) The existence of multiple processes with the same connection parameters
3) The presence of similar security protocols and settings
32. What are the parameters that control connection pooling behaviors in .NET?
1) Connect Timeout
2) Min Pool Size
3) Max Pool Size
4) Pooling
33. What is the meaning of AutoPostBack in .NET?
34. What is the difference between an abstract class and an interface in .NET?
Function | Stored Procedure |
Can only return one value | Can return any number of values |
No support for exception handling using try-catch blocks | Supports the usage of try-catch blocks for exception handling |
The argument consists of only one input parameter | Both input and output parameters are present |
A function can be called from a stored procedure | The stored procedure cannot be called from a function |
Advanced Interview Questions and Answers
35. How is the status of a DataReader checked in .NET?
If it is closed, a true value is returned, and if the reader is open, it returns a false value.
36. What are some of the templates that are present in Repeater control?
1) AlternatingItemTemplate
2) ItemTemplate
3) HeaderTemplate
4) FooterTemplate
5) SeparatorTemplate
37. What is the meaning of role-based security in .NET?
38. How many elements can a tuple hold in .NET?
The advantage of tuples in .NET is that they can be used as parameters or return type specifiers.
39. Can themes be applied to ASP.NET applications?
40. Differentiate between the user control and the custom control in the .NET framework.
If it is closed, a true value is returned, and if the reader is open, it returns a false value.
User Control | Custom Control |
Static Layout | Dynamic Layout |
No support for the toolbox | Supports the usage of the toolbox |
Tightly coupled control access | Loosely coupled control access |
Branches from UserControl | Branches from the control group |
41. What is the order of the events that take place in a page life cycle?
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_Load
7) Page_LoadComplete
8) Page_PreRender
9) Render
42. What are some of the security controls present in ASP.NET?
asp: PasswordRecovery:
Used to send an email to a user upon performing a password reset operationasp: Login:
Gives the provisions of login controls with ID and password fields for users to login via credentialsasp: LoginName
Used to display the name of the user who has logged into the systemasp: LoginStatus
Used to denote the authentication flag of the user who has logged inasp: LoginView
Used to provide a variety of views based on themes upon user login43. What are the types of cookies available in ASP.NET?
Session cookies:
Present on the client machine and valid only for single sessionsPersistent cookies:
Present on the user machine and has a specific period denoting its expiry44. What is the use of MIME in .NET?
During a web transmission, servers have the ability to add in a MIME header to the beginning to denote that it is a MIME transaction.
45. What do you mean by cross-page posting?
There is a property called PostBackUrl, which helps you achieve cross-page posting.
46. Have you earned any sort of certification to boost your opportunities as a .NET Developer?
It adds immense value to possess a certification from a reputable organization to prove to the interviewer that you have learned the concepts thoroughly and have applied the same using industry-level projects, which have provided you with ample experience about using .NET in the real world!
47. What skills should a successful .NET Developer possess?
1) NET MVC architecture
2) Database handling
3) Client-side web development
4) .NET core