Interview questions for . Net core
1. Explain about major components of the .NET framework?
The major components .NET framework are given below:
• Common Language Runtime(CLR):
o It is an execution engine that runs the code and provides services that make the development process easier.
o Services provided by CLR are memory management, garbage collection, type safety, exception handling, security, and thread management. It also makes it easier for designing the applications and components whose objects interact across the languages.
o The programs written for the .NET Framework are executed by the CLR regardless of programming language. Every .NET Framework version is having CLR.
• Framework Class Library(FCL):
o It has pre-defined methods and properties to implement common and complex functions that can be used by .NET applications. It will also provide types for dates, strings, numbers, etc.
o This class library includes APIs for database connection, file reading and writing, drawing, etc.
• Base Class Library(BCL):
o The Base Class Library(BCL) has a huge collection of libraries features and functions that are helpful in implementing various programming languages such as C#, F#, Visual C++, etc., in the .NET Framework.
o BCL is divided into two parts. They are:
User-defined class library: It includes Assemblies.
Assembly: A .NET assembly is considered as the major building block of the .NET Framework. An assembly in the CLI(Common Language Infrastructure) is a logical unit of code, which is used for security, deployment, and versioning. Assembly can be defined in two forms namely Dynamic Link Library(.dll) and executable(.exe) files.
When compilation of the .NET program takes place, metadata with Microsoft Intermediate Language(MSIL) will be generated and will be stored in a file called Assembly.
Predefined class library: It contains namespace.
Namespace: It is the collection of pre-defined methods and classes that are present in the .Net Framework. A namespace can be added to a .NET program with the help of “using system”, where using represents a keyword and system represents a namespace.
• Common Type System(CTS):
o CTS specifies a standard that will mention which type of data and value can be defined and managed in memory during runtime.
o It will make sure that programming data defined in different languages should interact with each other for sharing the information. For example, in VB.NET we define datatype as integer, while in C# we define int as a data type.
o It can be used to prevent data loss when you are trying to transfer data from a type in one language to its equivalent type in another language.
• Common Language Specification (CLS):
o Common Language Specification (CLS) is a subset of CTS and defines a set of rules and regulations to be followed by every .NET Framework’s language.
o A CLS will support inter-operability or cross-language integration, which means it provides a common platform for interacting and sharing information. For example, every programming language(C#, F#, VB .Net, etc.) under the .NET framework has its own syntax. So when statements belonging to different languages get executed, a common platform will be provided by the CLS to interact and share the information.
2. What is an EXE and a DLL?
EXE and DLLs are assembly executable modules.
EXE is an executable file that runs the application for which it is designed. An EXE is produced when we build an application. Therefore the assemblies are loaded directly when we run an EXE. However, an EXE cannot be shared with the other applications.
Dynamic Link Library (DLL) is a library that consists of code that needs to be hidden. The code is encapsulated inside this library. An application can consist of many DLLs which can be shared with the other programs and applications.
3. What is a delegate in .NET?
A delegate is a .NET object which defines a method signature and it can pass a function as a parameter.
Delegate always points to a method that matches its specific signature. Users can encapsulate the reference of a method in a delegate object.
When we pass the delegate object in a program, it will call the referenced method. To create a custom event in a class, we can make use of delegate.
4. What are security controls available on ASP.NET?
Following are the five security controls available on ASP.NET:
• <asp: Login> Provides a login capability that enables the users to enter their credentials with ID and password fields.
• <asp: LoginName> Used to display the user name who has logged-in.
• <asp: LoginView> Provides a variety of views depending on the template that has been selected.
• <asp: LoginStatus> Used to check whether the user is authenticated or not.
• <asp: PasswordRecovery> Sends an email to a user while resetting the password.
5. What is boxing and unboxing in .NET?
Boxing is the process of converting a value type into a reference type directly. Boxing is implicit.
Unboxing is the process where reference type is converted back into a value type. Unboxing is explicit.
An example is given below to demonstrate boxing and unboxing operations:
int a = 10; // a value type
object o = a; // boxing
int b = (int)o; // unboxing
6. What is MIME in .NET?
MIME stands for Multipurpose Internet Mail Extensions. It is the extension of the e-mail protocol which lets users use the protocol to exchange files over emails easily.
Servers insert the MIME header at the beginning of the web transmission to denote that it is a MIME transaction.
Then the clients use this header to select an appropriate ‘player’ for the type of data that the header indicates. Some of these players are built into the web browser.
7. 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.
8. 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.
9. What is .NET?
.NET is a developer platform to build a variety of applications for web, mobile, desktop, and IoT. It supports various languages like C#, F#, Visual Basic, J#, C++, etc. for building the applications.
10. What is the .NET framework?
The .NET framework is a software development platform that supports an object-oriented approach. It offers services, like memory management, networking, security, and type safety.
11. What languages does the .NET Framework support?
.NET Framework supports over 60 programming languages, out of these 11 programming languages are designed and developed by Microsoft.
4. What are the most important aspects of .NET?
.NET is an open-source platform containing around 32 programming languages and several tools for application creation. It is highly secure and runs comfortably on multiple computer platforms.
12. Explain OOP and its relation to the .NET Framework?
OOP is the acronym for Object-Oriented Programming. It is a programming structure that uses self-contained entities called ‘objects’ instead of methods to achieve the desired functionality. OOP allows .NET developers to create modular programs and classes containing methods, properties, fields, events, and other logical modules.