Interview questions for .Net developer
1. What is the .NET framework?
.NET is one of the platforms provided by Microsoft, which is used to build a variety of applications using Windows.
The ability to develop classes, libraries, and APIs and run, debug, and deploy code onto web services and applications form to be 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 a cross-page posting?
Cross page posting is used to submit a form to a different page while creating a multi-page form to collect information from the user. You can specify the page you want to post to using the PostBackURL attribute.
Discuss the difference between constants and read-only variables.
Constant fields are created using const keyword and their value remains the same throughout the program. The Read-only fields are created using a read-only keyword and their value can be changed. Const is a compile-time constant while Read-only is a runtime constant.
3. What are some of the common components of .NET?
There are a lot of components that make up the .NET framework, and some of them are as follows:
• .NET Class Library
• .NET Framework
• Language Runtime
• Application Domain
4. What does JIT stand for in .NET?
JIT is the abbreviation of Just in Time. It is a compiler that is used to convert intermediate code into native code easily.
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.
5. What are EXE and DLL?
EXE is an executable file that works as an application and it runs individually as it contains an entry point. DLL is a Dynamic Link Library which is a supportive file to other applications, and it cannot run individually
6. What is the meaning of MSIL?
MSIL is the abbreviation of Microsoft Intermediate Language. It is used to provide the instructions required for operations such as memory handling, exception handling, and more. It can also provide instructions to initialize and store values and methods easily.
The next .NET interview question we will check involves an important concept.
7. What is CTS?
CTS stands for Common Type System. It is a set of structured rules that govern what a data type should be for the corresponding values given by a user. It is used to describe all of the data types that are used in an application that the user is building.
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.
8. What is the difference between Stack and Queue?
The values in a stack are processed following the LIFO (Last-In, First-Out) principle, so all elements are inserted and deleted from the top end. But a queue lists items on a FIFO (First-In, First-Out) basis in terms of both insertion and deletion. The elements are inserted from the rear end in a queue and deleted from the front end.
9. What is CLS?
CLS stands for Common Language Specification in .NET. It is put into place to ensure that the application developer is capable of inter-language operations if required. It is a reusable aspect among all of the .NET compatible languages.
10. What are the types of caching in .NET?
There are 3 types of caches in .NET:
• In-Memory Cache
• Persistent in-process Cache
• Distributed Cache
11. What does CLR stand for in .NET?
CLR stands for Common Language Runtime. It forms to be the most vital component of .NET as it provides the foundation for many applications to run on.
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:
• Memory management
• Security protocols
• Libraries for loading
• Thread management
Next up on this top .NET basic interview questions and answers, we need to understand a very important difference. Check it out.
12. What are the differences between system.stringbuilder and system.string?
System.string is immutable and fixed-length, whereas StringBuilder is mutable and variable length. The size of .string cannot be changed, but that of .stringbuilder can be changed.
13. How does managed code execute in the .NET framework?
There are four main steps that include in the execution of the managed code. They are as follows:
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 to native code using JIT
4. Native code is now executed using the .NET runtime
14. Explain the difference between value type and reference type?
Types in .NET Framework are either Value Type or Reference Type. A Value Type is stored in the stack and it holds the data within its own memory allocation. While a Reference Type is stored in the heap and it contains a pointer to another memory location that holds the real data.
15. What is OOP and how does it relate to the .NET Framework?
OOP stands for object-oriented programming. A good answer to this question would point out that OOP languages such as Visual Basic.NET, C# and C++ are the core languages supported by .NET Framework. (There is also support for functional programming in the form of F#.)
As a technique, OOP allows .NET developers to create classes containing methods, properties, fields, events and other logical modules. It also lets developers create modular programs, which they can assemble as applications. OOPs have four basic features: encapsulation, abstraction, polymorphism and inheritance.
16. What is encapsulation?
Encapsulation is one of four basic features of OOP and refers to the inclusion within a program object of methods and data needed for the object to function. For .NET interview questions like this, candidates should mention that encapsulation helps keep data from unwanted access through binding code and data in an object, which is the basic, single self-contained unit of a system.
Another way of understanding encapsulation is to think of it as “hiding” the state of an object as private or protected. Under this principle of information hiding, the internal workings of an object are segregated from the rest of the application. This is useful because it makes it less likely that other objects can modify the state or behavior of the object in question.
17. What is the difference between Stack and Heap?
The stack is used for static memory allocation and access to this memory is fast and simple to keep track of. Heap is used for dynamic memory allocation and memory allocation to variables that happens at run time. Accessing the heap memory is complex and slower compared to stack.