Top 40 .NET Interview Questions and Answers (2024)

Here are .NET Interview Questions interview questions and answers for freshers as well as experienced candidates to get their dream job.


1) Explain what is .NET Framework?

The.Net Framework is developed by Microsoft. It provides technologies and tool that is required to build Networked Applications as well as Distributed Web Services and Web Applications.


2) What does .NET Framework provides?

.NET Framework renders the necessary compile time and run time foundation to build and run any language that conforms to the Common Language Specification (CLS).

Free PDF Download: .NET Interview Questions and Answers


3) Mention what are main components of .Net framework?

The main components of .Net framework are

  • Common Language Runtime (CLR)
  • .Net Framework Class Library (FCL)
  • Application Domains
  • Runtime Host
  • Cross-Language Interoperability
  • Side-by-Side Execution
  • Profiling
  • Dynamic Language Runtime (DLR)
  • Common Type System
  • Metadata and Self-Describing Components
  • .Net Framework Security
  •  Model View Presenter (MVP) Architecture

4) Mention key characteristics of .NET ?

  • Unlike other programming language, in .NET the program will be compiled into an intermediate language representation known as MSIL (Microsoft Intermediate Language)
  • MSIL code does not contain any API calls particular to any platform
  • Compiler checks only for syntax and the necessary semantics as such it is
  • Libraries used by the program are linked even before generating MSIL. It is linked in an un-compiled form
  • Instead of directly calling API of the operating system, the program uses CLR to call API. CLR acts as mediator
  • Garbage collection and automatic memory management are done by CLR

5) Mention what are the languages that .NET supports?

Languages that .NET supports are,

  • NET
  • C#
  • COBOL
  • PERL
.NET Interview Questions
.NET Interview Questions

6) Mention how big is the datatype int in .NET?

Datatype int in .NET is 32 bits.


7) Mention what is .Net Namespaces?

Namespaces in .NET is nothing but a way to organize .NET Framework Class Library into a logical grouping according to their usability, functionality as well as category they belong to.


8) Mention what is MSIL in .NET ?

  • MSIL stands for Microsoft Intermediate Language
  • During the compile time, the source code is converted into Microsoft Intermediate Language (MSIL) by compiler
  • MSIL is a CPU-independent set of instructions that can be efficiently converted to the native code

9) Mention what are the functions .NET Assembly performs?

Assembly is the main unit of deployment in a .NET Framework application executed as .exe or .dll.

An assembly performs following functions

  • It consists of an IL code that gets executed by common language runtime
  • It forms a security boundary
  • By establishing name scope for types at the runtime, it ensures safety
  • It carries version information
  • It enables side-by-side execution of multiple versions of the same assembly
  • Assembly is where permission is requested and granted.

10) Mention what is .Net Assembly Manifest?

.Net Assembly Manifest is a file which contains metadata about .NET Assemblies.  It describes how the elements in the assembly relate to each other. In other words, it describes the relationship and dependencies of the components in the Assembly, scope information, versioning information, etc.


11) Mention what is MSIL in .NET ?

Microsoft Intermediate Language (MSIL) includes instructions for storing, loading, initializing, and calling methods on objects, as well as instructions for logical and arithmetic operations, direct memory access, control flow, exception handling, and other operations.


12) Explain what is PE (Portable Executable) File format?

The Portable Executable (PE) format is a file format for executables, object code, and DLLs, used in 64-bit and 32-bit versions of Windows operating systems.


13) Mention what is the difference between Assembly and Namespace?

  • Namespace can span multiple assemblies
  • Namespace can logically groups class
  • Assembly is a physical grouping of logical units

14) List out the namespace provided by .net for data management?

The namespace provided by .net for data management include,

  • Data
  • Data.SQLClient
  • XML

.NET Interview Questions


15) Mention what is GAC in .net ?

GAC stands for Global Assembly Cache. It is an area of memory reserved to store the assemblies of all .NET applications that are running on a certain machine.


16) Mention what is STA in .NET?

STA or single threaded apartment model offers a message-based paradigm for dealing with multiple objects running concurrently. Every thread lives within its own apartment.


17) Mention what is data access modifier in .NET?

Data access modifier in .NET provide a class, a function or a variable with accessibility.


18) Mention what are the types of access modifier in .NET?

The access modifier in .NET are five types

  • Public
  • Private
  • Protected
  • Internal
  • Protected Internal

19) Mention the type of code security available in .NET?

The type of code security available in .NET are

  • Role based security: This authorizes the user.
  • Code access security: This protects system resources from unauthorized calls.

20) Explain how you can implement singleton pattern in .NET?

To implement singleton pattern in .NET, following steps, has to be implemented.

  • Create a class with static members
  • Define a private constructor
  • To access the singleton object, a static method can be used

21) Explain how the exception is handled in .NET?

In .Net, when there is an exception, the .NET framework creates an object of type ‘Exception’ and ‘throws’ it. This Exception object will have all the information about the ‘error’.

If you have enclosed your code within the try-catch block, you will receive the exception object in the ‘catch’ block when the exception occurs.


22) Explain how can you create and use an array in .NET?

In .NET, you can create array by following ways,

  • Declaring a reference to an array
  • Create array of ten Int32elements
  • Creating a 2-dimensional array
  • Creating a 3-dimensional array

23) Mention what is user-defined data type?

A user-defined data type is a named data type created by the user. It can be a structured type which has a sequence of named attributes that each has a type, or It can be a distinct type sharing a common representation with some built-in data type.  Based on this it can be categorized as,

  • Distinct type
  • Reference type
  • Structured type

24) List out few of the .Net base class library namespace?

The .Net base class library encapsulates a huge number of common functions and makes them easily accessible to the developer.

Few of the .Net base class library namespace are

  • Activities
  • Collections
  • Configuration
  • EnterpriseServices
  • Management
  • Runtime and so on

25) Mention what is the difference between structures and classes in .NET?

Classes Structures
Usually, it is used for large volume of data It is used for smaller amounts of data
It can be inherited It cannot be inherited
It can be NULL It cannot be NULL like the class.
For class the keyword used is ‘class’. For structure the keyword used is ‘struct’.
By default class member variables are private. By default structure, members have public access.
It contains a volatile field. It cannot contain the volatile field.
Cannot use size of operator Can use size of operator
Fields are automatically initialized Fields are not initialized automatically

26) Mention the types of multidimensional arrays used in .NET ?

The types of multidimensional arrays used in .NET are,

  • Jagged Arrays: These type of multidimensional arrays have each sub-array as independent arrays of different lengths. For Jagged arrays, you need to use a separate set of square brackets.
  • Rectangular Arrays: These type of multidimensional arrays have all the sub-arrays with a particular dimension of the same length. For rectangular arrays, you need to use a single set of square brackets.

27) Explain how to add properties in.NET?

To add properties in.NET, either you can use property procedures or fields.


28) Mention what is event bubbling in .NET?

The event bubbling in .NET is defined as the passing of the control from child to the parent is called as bubbling.  Controls like datalist, datagrid, repeater, etc. can have child controls like listbox, etc.


29) Mention what are the debugging windows available?

The windows available while debugging include,

  • Breakpoints
  • Output
  • Immediate

30) Explain what is Microsoft Silverlight?

Micro-soft Silverlight is an open-source tool for making and deploying internet applications and media experiences on the web.

Silverlight architecture is made of mainly three components

  • Core presentation framework: The framework includes the components like data binding, vector graphics, text, animation, images for presenting various features,
  • .NET framework for Silverlight: It consists of the libraries and components like XLINQ, XML serialization, Syndication, base class libraries, networking and common language runtime,
  • Updater and Installer: It is a control for installation and provides automatic updates

Important features in Silverlight

  • Tooling: XAML debugging is included in this version, specially for the binding purpose
  • Media: You can control volume, pitch, in the soundeffect class
  • Text: Introduced RichTextBoxOverflow element, it will help in automatically laying out text in situations like multi-column
  • Data binding: It supports implicit data templates, which means you can specify a Data Template for a specific type in your binding
  • Controls: “Click Counts” will help basically in doing double-click tracking on elements in your application. Another feature is “Multiple-Window” support, it allows you to create several windows that your application can interact with
  • 3D graphics: 3D graphics API is available with new Silver light with many additional features
  • Trusted Application in Browser: Without being installed, applications can be used in the browser through this feature
  • General: Apart from all these features there are enhanced features that are supposed to be seen in Beta version, like vector printing, new DataContextchanged event, COM interop for trusted in-browser applications,

31) What Silverlight is composed of?

Silverlight comes with four main components

  • Silverlight Plug-in
  • Silverlight Host, the Web Page
  • Silverlight Application File (.XAP)
  • The Interface language, XAML

Silverlight plug in comes with many features like

  • Presentation Engine
  • XAML Parser
  • .NET Parser
  • .NET Framework
  • Media Features
  • Browser Interaction
  • Downloader

32) Explain what is .xap file?

.xap file is a compressed file for the Silver Application.  The .xap files include AppManifest.xaml, compile output assembly of the Silverlight project (.dll) and any other resources by the Silverlight application.  Visual studio creates two files when creates project; App.xaml and Page.xaml

To run a Silverlight application on a web server, you require to append the extension .XAP with the MIME type application/X-Silverlight in the server supported file types configuration.

The .XAP mime type is: application/x-Silverlight.


33) List out the tools required to build Silverlight applications?

Tools used for building Silverlight applications are

  • Microsoft Expression Studio: This tool is meant for web designers as it is used to create rich visual elements for Silverlight applications with enhanced visual contents and graphics
  • Microsoft Visual Studio: This tool is meant for a programmer whose application is based on logic or requires programming. It permits programmer to build Silverlight applications in any .NET language (like C#, NET, etc.)

The .NET application support in Silverlight can be segregated into two parts

  • Embedded Common Language Runtime (CLR)
  • .NET framework libraries

34) Mention whether Silverlight allows MPEG4 and H.264 videos or AAC (advanced audio coding) audio or flash video?

No, Silverlight does not support MPEG4 and H.264 videos. However, contents from many of these formats can be converted into formats that are supported by Silverlight like automated server function, and then inserted into a Silverlight based application.


35) Explain how you can host a Silverlight Applications?

Silverlight applications can be hosted on most types of the web server like Apache and IIS (Internet Information Server). To host Silverlight applications from your web server, you need to allow the MIME type as mentioned below

Extension MIME type
  • .XAML
  • .XAP
  •  Application/ xaml+xml
  • Application/ Silverlight-app

36) Mention what is the difference between WPF (Windows Presentation Foundation) and Windows Silverlight?

  • In terms of features, silver light is the subset of WPF
  • Silverlight competes with Adobes flash and is designed for developing rich browser based internet applications
  • While WPF is a Microsoft technology for developing enhanced graphics applications for desktop platform, while Silverlight can be used for building application accessed through internet
  • Web browser application can be hosted on web browsers that give rich graphics features for web applications.

37) Explain how you can pass parameters to silver light controls from ASP.NET pages?

You can pass parameters from you aspx pages and HTML pages to the Silverlight controls by setting InitParameters. The Xaml page user control has a property known as InitParameters. From your ASPX pages, you can set a value in the form of key value pairs. Since this property accepts key-value pairs, you can pass any set of string values.


38) Explain how Silverlight and ASP.NET AJAX can be used by consumers?

Silverlight synchronizes with existing web applications, including ASP.NET AJAX applications.  Apparently, ASP.NET AJAX and Silverlight are built as complementary technologies.  In short, Silverlight and ASP.NET AJAX can communicate with any AJAX application. Also, ASP.NET AJAX can additionally be used to control Silverlight-based visualization of data or delivery of rich experiences.


39) Explain how you can check the internet connection status in Silverlight?

By using the following code, you can check the internet connection

If (NetworkInterface.GetIsNetworkAvailable())

{
Messagebox.Show(“ Network available”);
}
else
{
Message.box.Show(“ Network not available”);
}

40) Explain what is RIA?

RIA stands for rich internet applications, and they are web applications with rich features. Rich features include built in AJAX support, layouts, animations, audio, and video components. Silverlight is an example of RIA.


41) Mention what are the different layout controls available in Silverlight?

There are three controls available like

  • StackPanel: It will position the child elements either in a vertical or horizontal manner
  • Grid: It will place the child elements in either rows or columns
  • Canvas: It will place the child elements according to X, Y space

42) What is the syntax for Net?

The syntax for ASP.Net usually consists of HTML file.  However, an ASP file can contain server script with delimiters.  An example of “Hello World !”

< ! DOCTYPE html>

< html >

< body >

< %

Response.write (“Hello World!”)

%>

</body>

</html>

These interview questions will also help in your viva(orals)

Share

Leave a Reply

Your email address will not be published. Required fields are marked *