Blog Details

blogimage
Admin
19 Apr 2025

.NET Interview Questions And Answers

Beginner .NET interview Questions

 

1: What is the .NET framework?

The .NET framework supports an object-oriented approach that is used for building applications on windows. It supports various languages like C#, VB, Cobol, Perl, .NET, etc. It has a wide variety of tools and functionalities like class, library and APIs that are used to build, deploy and run web services and different applications.

.net logo - .net interview questions - edureka

2: What are the different components of .NET?

Following are the components of .NET

  • Common Language run-time
  • Application Domain
  • Common Type System
  • .NET Class Library
  • .NET Framework
  • Profiling

3: What do you know about CTS?

CTS stands for Common Type System. It follows certain rules according to which a data type should be declared and used in the program code. CTS also describes the data types that are going to be used in the application. We can even make our own classes and functions following the rules in the CTS, it helps in calling the data type declared in one program language by other programming languages.

4: What is CLR?

CLR stands for common language run-time, it is an important component of the .NET framework. We can use CLR as a building block of various applications and provides a secure execution environment for applications.

Whenever an application written in C# is compiled, the code is converted into an intermediate language. After this, the code is targeted to CLR which then performs several operations like memory management, security checks, loading assemblies, and thread management.

5: Explain CLS.

Common language specification helps the developers to use the components that are inter-language compatible with certain rules that come with CLS. It then helps in reusing the code in other .NET compatible languages.

6: What do you know about JIT?

JIT is a compiler which stands for Just In Time. It is used to convert the intermediate code into the native language. During the execution, the intermediate code is converted into the native language.

7: Why do we use Response.Output.Write()?

Response.Output.Write() is used to get the formatted output.

8: What is the difference between Response.Redirect and Server.Transfer?

Response.Redirect basically redirects the user’s browser to another page or site. The history of the user’s browser is updated to reflect the new address as well. It also performs a trip back to the client where the client’s browser is redirected to the new page.

Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to the client’s browser. The history does not get updated in the case of Server.Transfer.

9: What is the difference between managed and unmanaged code?

Managed codeUnmanaged code
Managed code is managed by CLRAny code that is not managed by CLR
.NET framework is necessary to execute managed codeIndependent of .NET framework
CLR manages memory management through garbage collectionOwn runtime environment for compilation and execution

10: Explain the difference between a class and an object?

ClassObject
Class is the definition of an objectAn object is an instance of a class.
It is a template of the objectA class does not become an object unless instantiated
It describes all the methods, properties, etcAn object is used to access all those properties from the class.

11: What do you know about boxing and unboxing?

BoxingUnboxing
ImplicitExplicit
Converting a value type to the type objectExtracting the value type from the object
eg : obj myObject = i;eg : i = (int)myObject;

12: Differentiate between constants and read-only variables.

ConstantsRead-only Variables
Evaluated at compile timeEvaluated at run-time
Support only value type variablesThey can hold the reference type variables
They are used when the value is not changing at compile timeUsed when the actual value is unknown before the run-time
Cannot be initialized at the time of declaration or in a constructorCan be initialized at the time of declaration or in a constructor

13: What is BCL?

  • BCL is a base class library of classes, interfaces and value types
  • It is the foundation of .NET framework applications, components, and controls
  • Encapsulates a huge number of common functions and make them easily available for the developers
  • It provides functionality like threading, input/output, security, diagnostics, resources, globalization, etc.
  • Also serves the purpose of interaction between user and runtime
  • It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.

14: What are the different versions of the .NET framework?

Version .NET Framework Visual Studio
C# 1.0.NET Framework 1.0/1.1Visual Studio .NET 2002
C# 2.0.NET Framework 2.0Visual Studio 2005
C# 3.0.NET Framework 3.0/3.5Visual Studio 2008
C# 4.0.NET Framework 4.0Visual Studio 2010
C# 5.0.NET Framework 4.5Visual Studio 2012/2013
C# 6.0.NET Framework 4.6Visual Studio 2013/2015
C# 7.0.NET COREVisual Studio 2017

15: What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units whereas namespace groups classes. Also, a namespace can span multiple assemblies as well.

16: What is LINQ?

It is an acronym for Language integrated query which was introduced with visual studio 2008. LINQ is a set of features that extend query capabilities to the .NET framework language syntax that allows data manipulation irrespective of the data source. LINQ bridges the gap between the world of objects and the world of data.

17: What is MSIL?

MSIL is the Microsoft Intermediate Language, it provides instructions for calling methods, storing and initializing values, memory handling, exception handling and so on. All the .NET codes are first compiled to Intermediate Language.

 

Intermediate .NET interview questions

1: Explain the different parts of the assembly.

Following are the different parts of assembly:

  • Manifest: It has the information about the version of the assembly.
  • Type Metadata: Contains the binary information of the program
  • MSIL: Microsoft Intermediate Language Code
  • Resources: List of related files

2: How do you prevent a class from being inherited?

In C#, we can use the sealed keyword to prevent a class from being inherited.

3: What are the different types of constructors in c#?

Following are the types of constructors in C#:

  • Default Constructor
  • Parameterized constructor
  • Copy Constructor
  • Static Constructor
  • Private Constructor

4: What are the different types of assemblies?

There are two types of assemblies:

  • Private Assembly: It is accessible only to the application, it is installed in the installation directory of the application.
  • Shared Assembly: It can be shared by multiple applications, it is installed in the GAC.

5: What are MDI and SDI?

  • MDI( Multiple Document Interface): An MDI lets you open multiple windows, it will have one parent window and as many child windows. The components are shared from the parent window like menubar, toolbar, etc.
  • SDI( Single Document Interface): It opens each document in a separate window. Each window has its own components like menubar, toolbar, etc. Therefore it is not constrained to the parent window.

6: What is the difference between custom and user control?

Custom ControlUser Control

Derives from control

Derives from UserControl

Dynamic Layout

Static Layout

Defines a single control

Defines a set of con

It has full toolbox support

Cannot be added to the toolbox

Loosely coupled control

Tightly coupled control

7: What is a garbage collector?

Garbage collector feature in .NET frees the unused code objects in the memory. The memory head is divided into 3 generations:

  • Generation 0: It stores short-lived objects.
  • Generation 1: This is for medium-lived objects.
  • Generation 2: It stores long-lived objects.

Collection of garbage refers to the collection of objects stored in the generations.

8: What is caching?

Caching simply means storing the data temporarily in the memory so that the data can be accessed from the memory instead of searching for it in the original location. It increases the efficiency of the application and also increases its speed.

Following are the types of caching:

  • Page caching
  • Data caching
  • Fragment caching

9: Explain MVC.

MVC stands for model view controller which is an architecture to build .NET applications.

Model: They are the logical part of any application that handles the object storage and retrieval from the databases for an application.

View: View handles the UI part of an application. They get the information from the models for their display.

Controller: They handle the user interactions, figure out the responses for the user input and also render the view that is required for the user interaction.

Whatsapp to Grownet