Microsoft’s. NET framework is a collection of tools, functions, libraries, classes, and APIs for running, debugging, and deploying code on online services. It is object-oriented programming. This blog covers the most frequently asked .NET and.NET interview questions.
Here are a few facts about.NET Core:
- The free and open-source.NET Core source code project is available on GitHub. The MIT and Apache licenses specify how to use it for free.
- Cross-platform:.NET Core is compatible with several operating systems, including Windows, macOS, and Linux.
- Shareable: All.NET apps use the same API model developed in.NET Standard and used by.NET Core. The same library or application programming interface (API) can be used across multiple languages and platforms.
- Fast:.NET Core 3.0 outperforms the.NET Framework,.NET Core 2.2, and previous versions. It is also much faster than its main competitors, server-side frameworks such as Java Servlet and Node.js.
How does the.NET framework function?
On the.NET framework, applications written in C#, F#, or Visual Basic are “compiled” into Common Intermediate Language (CIL).
When code is compiled and saved, it takes the form of an assembly file with the extension.dll or.exe.
When the.NET program is executed, the Common Language Runtime (CLR) reads the assembly file and converts the CIL to machine code using the Just In Time (JIT) compiler.
This machine code can now run on the architecture of the computer on which it is currently running.
What are DLL and EXE files used for?
Both EXE and DLL files are executable modules.
An EXE, “executable file,” executes the program it was designed for. When we create an application, we create an EXE file. As a result, when we run an EXE, the assemblies load immediately. However, an EXE cannot be shared with other apps.
The code that must be hidden is located in a Dynamic Link Library (DLL) library. This library contains all of the code in one location. An application includes a large number of DLLs that are shared by other programs and applications.
You Must Know: Top Data Science Interview Questions: Easy or Hard?
What is CTS?
The Common Type System is abbreviated as CTS. A data type must be declared and used according to a set of rules in computer code. It defines all of the data types that will be used in the program.
Following the CTS rules, we can create our classes and functions. It facilitates data types declared in one programming language by other programming languages.
The Common Language Standard (CLS) is a set of rules that allows application developers to use parts that work in multiple languages. Furthermore, it allows for code reuse across all. NET-compatible languages.
JIT is an abbreviation for “Just In Time.” When the intermediate code is run, a compiler converts it to the native language.
6. How do you distinguish between an int and an Int32?
There is no distinction between int and Int32. In C#, int is another name for Int32, but Int32 is a type provided by the.NET framework class.
7. Distinguish between reference and value types
The following are the primary distinctions between value type and reference type:
A pointer in a reference type holds the address of a different memory location where the actual data is stored. On the other hand, the data for a value type is stored directly in the memory region.
The heap stores data of the reference type, whereas the stack stores data of the value type.
When you assign a reference variable to another variable, you receive a duplicate of the reference rather than the value. You get a copy of the deal when you do the same thing with a value variable.
Structures, enums, and data types that have already been defined are examples of value types. Classes, objects, arrays, indexers, interfaces, and other types are examples of reference types.
8. What exactly is an assembly?
An assembly is a file generated by the compiler. It is a set of types and resources designed to form a logical unit of functionality. Assembly is a type of assembled code that also serves as a logical code unit.
Executable (.exe) or dynamic link library (.dll) files assemble assemblies.
9.What is the difference between ASP.NET and ASP?
ASP.NET and ASP (Active Server Pages) are different technologies.
Let’s take a look at what distinguishes them.
- C# and VB.NET, compiled into Microsoft Intermediate Language, are used in ASP.NET (MSIL). ASP uses VBScript. When ASP code is executed, it is interpreted.
- ASP is a Microsoft server-side technology used to create web pages. Another Microsoft product, ASP.NET, is used to create dynamic web applications.
- ASP is only partially object-oriented, whereas ASP.NET is entirely object-oriented.
- ASP does not have built-in XML support, but ASP.NET does. This facilitates data sharing.
- ADO.NET is a technology that ASP.NET uses to connect to and interact with databases. ADO is a technology used by ASP.
10. Explain how .NET role-based security works
Security in .NET is implemented using role-based security, which is based on users’ roles in the company. Permissions are granted to users in the company based on their actions.
For example, Windows grants users, administrators, and visitors access based on their roles.
11. Describe the various types of assemblies.
There are two kinds of assemblies.
- Private assembly:
Only the application can see it.
We must include a copy of this private assembly in each application folder where it will be used. To get to the secret meeting, we must copy.
To install it, place it in the application’s installation directory.
- Shared or Public Assembly
Multiple shows can use it.
There is no need to make separate copies for each program folder at a public assembly. At the system level, only one copy of public assembly is required, and multiple applications can use it.
It can be found in the Global Assembly Cache (GAC).
12. What is a garbage collector?
The garbage collector removes out-of-date code objects from memory. The memory heap is partitioned into 3 generations:
- Generation 0: It holds short-lived objects.
- Generation 1: It stores medium-lived objects.
- Generation 2: This is for long-lived objects.
Searching for items in the managed heap’s generations that the application no longer requires is known as “garbage collection.”
13.What exactly are caches?
“Caching” refers to temporarily storing data in memory so that applications can use it without looking for it elsewhere. An application’s speed and performance are improved.
Caching is classified into three types:
- Page caching
- Data caching
- Fragment caching
14.What is the use of manifest in the .NET framework?
Manifest stores the metadata of the assembly. It contains metadata which is required for many things as given below:
- Assembly version information.
- Scope checking of the assembly.
- Reference validation to classes.
- Security identification.
15. Explain different types of cookies available in ASP.NET?
Two types of cookies are available in ASP.NET. They are:
- Session Cookie: It resides on the client machine for a single session and is valid until the user logs out.
- Persistent Cookie: It resides on the user machine for a period specified for its expiry. It may be an hour, a day, a month, or never.
So this is the list of some of the most frequently asked .NET Interview Questions you will need before preparing for your Interview.