Top ASP.NET Interview Questions 2023

By Archer Charles 07-Feb-2023
Top ASP.NET Interview Questions 2023

ASP.NET refers to the open-source web framework used to understand secure, fast web services and applications with .NET. It is also the cross-platform framework with the largest draws. What this means is it can run using every operating system, allowing you to build ASP.NET applications with Jquery, HTML, Javascript or CSS. You can also use it to build an API that any third-party resource can consume, such as Facebook, Google or Microsoft. 

After you clear the ASP.NET exam, the next big step is the interview. Here are the top ASP.NET interview questions at the beginner and intermediate levels.

ASP.NET Interview Questions You Should Know:

Q1. Explain CTS.

A1. CTS is the short form of ‘Common Type System’. CTS follows structured rules that stipulate data type needs to be declared and used in program code. It describes every data type that the application will use. You can create functions and classes of your own using the rules of CTS. This will help call the data type ‘declared’ by other languages when written using a specific programming language. 

Q2. What is CLS?

A2. CLS stands for Common Language Specification. It allows app developers to use inter-language compatible components with the rules that follow CLS. Additionally, it will enable developers to reuse this code among other languages compatible with .NET.

Q3. What is JIT?

A3. JIT is Just in Time. It refers to a compiler used during execution for converting intermediate code into a native language. 

Q4. Do you know the difference between int32 and int?

A4. Int and Int32 are no different from each other. Int is short for Int32 in C# language. Int32 refers to a type that the class of the .NET framework provides. 

 Talk to Our Counselor Today 

Q5. What are the differences between reference type and value type?

A5. There are many differences between reference type and value type.

  • Reference type holds a pointer made up of another memory location’s address that is holding the real data. Value type holds the real data within its memory location directly. 
  • The contents in the reference type are stored in its heap memory. The contents in the reference type are stored in stack memory. 
  • When a reference type variable is assigned to another, a second copy is created of that reference instead of copying it. When a value type variable is assigned to a different variable, the value is copied directly.
  • Some reference type examples are classes, objects, indexers, arrays and interfaces. Some value type examples are structures, predefined data types and enums. 

Q6. What are the differences between unmanaged and managed code?

A6. Let’s take a look at some key differences:

  • Managed code is managed by CLR, while unmanaged code is not. 
  • Managed code needs a .NET framework to be executed, while unmanaged code does not.
  • Managed code uses garbage collection for memory management. Unmanaged code uses its runtime environment for memory management. 

Q7. What is Microsoft Intermediate Language?

A7. MSIL or Microsoft Intermediate Language is a language instructing users on calling, value initialising and storing, memory handling, and exception handling, among others. These instructions don’t depend on any platform and get generated through a language-specific compiler the source code has. A JIT compiler combines the Microsoft Intermediate Language into code depending on the need. 

You May Also Like: All about ASP.NET Core 2.1

Q8. What is an assembly?

A8. It is an automatically generated file that the compiler generates, composed of several resources and types designed to function today, forming a logical functionality unit. 

In other words, you could define assembly as a logical unit of code and compiled code. These files are implemented in one of two formats - executable or .exe and dynamic link library or .dll.

Q9. Are ASP and ASP.NET different? If so, how are they different?

A9. ASP stands for active server pages. ASP and ASP.NET are pretty different from each other. Let’s look at the key differences.

  • ASP uses VBScript, and this code gets interpreted at the execution stage. ASP.NET uses languages related to .NET like VB.NET and C#. These languages are compiled to MSIL.
  • ASP is used to create pages as it is a server-side tech by Microsoft. ASP.NET was designed for dynamic web app creation and was developed by Microsoft. 
  • ASP is object-oriented partially, while ASP.NET is entirely object-oriented. 
  • ASP has no in-built XML support to exchange data, while ASP.NET offers complete XML support. 
  • ASP connects with and works along with databases using ADO technology. ASP.NET does so using ADO.NET tech.

Q10. What are the different assembly types?

A10. Private assembly and public or shared assembly categorise two types of assemblies:  

Private assembly:

  • Only the application can access it.
  • The private assembly needs to be copied separately into every application folder where you want the assembly to be used. If you don’t copy it, the private assembly is no longer accessible. 
  • It should be installed within an application’s installation directory. 

Public or shared assembly:

  • A public assembly can easily be shared across multiple applications. 
  • It doesn’t need to be copied individually into every application folder. You only need a single copy of a public assembly at a system level that can be used across several applications. 
  • It should be installed in the GAC (Global Assembly Cache).

Q11. Describe a garbage collector in the ASP.NET context?

A11. The garbage collector feature is used to free unused code items in the system’s memory. The memory heap of a garbage collector is divided into three generations.

  • Generation 0 contains short-lived objectives 
  • Generation 1 contains medium-lived objects 
  • Generation 2 contains long-lived objects

Garbage collection describes the process of checking for objects across all the generations in the managed heap that the application is no longer using. It also executes all critical processes and operations for reclaiming memory. A collection needs to be performed by the garbage collector to free up some memory space. Multiple things happen in the process of garbage collection. These are:

  • Recognising the list of active or live objects.
  • Updating references for compacted objects.
  • Recollecting any memory being used by dead obj ects. Any remaining objects get removed to older segments. 

The method used for performing garbage collection is system.GC.collect() in .NET.

Q12. What do you know about caching?

A12. Caching is the process that temporarily stores data in the system’s memory, allowing easy access to the data through an application via the system memory instead of looking in the original location. It significantly enhances the performance and speed of an application. 

Three types categorise caching:

  • Data caching
  • Page caching
  • Fragment caching

Q13. What is MVC?

A13. MVC is the short form of Model View Controller, an architecture used while creating .NET applications. There are three main parts of MVC- model, view and controller.

Model:

A model holds data and logic related to it. It is best for handling the storing and retrieval of objects from an application’s database. For example, a controller object retrieves employee data from a database. Then it either manipulates this data and sends it back or retains and renders this data.

View: 

This part takes care of the UI of applications. Views get data for display from the existing models. For example, an employee’s view can have dropdowns, text boxes and several other components. 

Controller:

A controller handles user interactions, manages and formulates user input responses and renders the given output. For example, an employee controller handles every interaction and input using the Employee View and updates its database via the Employee Model.

Q14. In .NET, what’s a delegate?

A14. A delegate can be a .NET object that defines the signature of a method. It can easily pass functions as parameters. This delegate always redirects to methods that match its signature. A user can cover a method reference within a delegate object. When such an object is passed in programs, it’s called the referenced method. Delegates are used for creating custom events within a class. 

Q15. What purpose does manifest service in the .NET framework?

A15. The role of the manifest is to store the assembly’s metadata. Manifest stores metadata that needed for several things like, including: 

  • Checking the scope of the assembly
  • Data about assembly version
  • Identification for security
  • Validating references to a class

Q16. What does CAS mean in .NET?

A16. CAS or Code Access Security is necessary to prevent unauthorised access to resources and programs while they are running. CAS became critical in solving issues that arise while code is being obtained from external sources. This code could contain vulnerabilities and bugs that could expose a user’s system. CAS also limits accessibility to code so that it performs specific functions rather than all of them at any point. It makes up part of the .NET native security architecture.

Q17. Which types of memories are supported in the framework of .NET?

A17. There are two main memory types in the .NET framework. These are:

  • Stack: This type stores values and tracks every executing threat along with its location. Stack is ideal for allocating static memory. 
  • Heap: This type stores references and tracks more precise data and objects. Heap is used to allocating dynamic memory. 

 Enquire Now 

Associated Course

32 Hours
English
32 Hours
English
32 Hours
English
Archer Charles

Archer Charles has top education industry knowledge with 4 years of experience. Being a passionate blogger also does blogging on the technology niche.