.NET Framework Interview Questions

Posted by: Suprotim Agarwal , on 7/25/2007, in Category Interview Questions
Views: 429615
Abstract: The .NET Framework Interview Questions will give you an insight to the .NET platform. They form the basis of an interview and the interviewer asks them to guage your familiarity with the platform. The q&a have been collected over a period of time using MSDN and other similar sites.
.NET Framework Interview Questions
The Q&A mentioned over here have been taken from forums, my colleagues and my own experience of conducting interviews. I have tried to mention the contributor wherever possible. If you would like to contribute, kindly use the Contact form. If you think that a credit for a contribution is missing somewhere, kindly use the same contact form and I will do the needful.
What is the Microsoft.NET?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services. It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications.
What is the .NET Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.
What is CLR?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.
What is CTS?
Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
What is CLS?
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.
What is managed code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code.
What is MSIL?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
What is JIT?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.
What is portable executable (PE)?
PE is the file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.
What is an application domain?
Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.
How does an AppDomain get created?
AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications.
What is an assembly?
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.
What are the contents of assembly?
A static assembly can consist of four elements:
·         Assembly manifest - Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.
·         Type metadata - Binary information that describes a program.
·         Microsoft intermediate language (MSIL) code.
·         A set of resources.
What are the different types of assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for an application.
What is a dynamic assembly?
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies.
What is a strong name?
You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly's identity (text name, version number, and culture information), a public key and a digital signature generated over the assembly.  The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation.
What is GAC? What are the steps to create an assembly and add it to the GAC?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
- Create a strong name using sn.exe tool eg: sn -k mykey.snk
- in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]
- recompile project, and then install it to GAC in two ways :
·         drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
·         gacutil -i abc.dll
What is the caspol.exe tool used for?
The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.
What is a garbage collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.
What are generations and how are they used by the garbage collector?
Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations.
What is Ilasm.exe used for?
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.
What is Ildasm.exe used for?
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.
What is the ResGen.exe tool used for?
ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.
If you liked the article,  Subscribe to my RSS Feed or Subscribe Via Email

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigious Microsoft MVP award for Sixteen consecutive years. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that offers Digital Marketing and Branding services to businesses, both in a start-up and enterprise environment.

Get in touch with him on Twitter @suprotimagarwal or at LinkedIn

Page copy protected against web site content infringement 	by Copyscape

Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by Divya Sachdev on Thursday, August 2, 2007 8:04 AM
This site has been extremely helpful for me.
The points written here are:
1. easily understandable
2. to the point with apt explaination
3. obviously :) provide required amount of knowledge
Comment posted by Mukesh Chandwani on Thursday, August 16, 2007 7:23 AM
Excellent work
Comment posted by champ_Vicks on Tuesday, August 21, 2007 7:21 AM
Good question and understable
Comment posted by A.DurgaPrasad on Monday, February 11, 2008 9:59 AM
These questions are very good.I am a project trainer in .net.This type of articles will help me to give  interview gudance to my students.If any list is there please mail me.
Comment posted by elegantkvc on Thursday, March 13, 2008 11:00 AM

The article is good.If abbrevations are there,it will be more helpful..:)
Comment posted by Sheo Narayan on Thursday, April 24, 2008 1:14 PM
I found this one interesting with random interview question test features here
Comment posted by susmitha on Wednesday, May 21, 2008 9:58 AM
i did .net.as a fresher i wil not expect how interviewer ask questions.it's very useful
all of them.
i think to study this questions ,before attending interview is very helpful.
i would like to say thanq for who has taughat for putting  this information.
Comment posted by suprotim agarwal on Thursday, May 22, 2008 11:27 AM
Thanks everyone for their comments. I will try and add some new questions in the near future.
Comment posted by Amit Gupta on Saturday, May 31, 2008 4:27 PM
This site is amazing.You can easily understand everything.You just try once i am defilnitely sure u will get everythng which u want.Thanx a ton dotnetcurry.
Comment posted by Suprotim Agarwal on Sunday, June 1, 2008 1:32 AM
Thanks for your comments Amit. Keep visiting us :)
Comment posted by chandra prakash on Wednesday, June 11, 2008 10:34 AM
i read this article.it is awesome task.
You just try once i am defilnitely sure u will get everythng which u want.Thanx a ton dotnetcurry.
Comment posted by Suprotim Agarwal on Tuesday, June 17, 2008 11:54 AM
Thanks ChandraPrakash for the nice comments :)
Comment posted by krishna kumar on Saturday, June 21, 2008 5:27 AM
Excellent articles.Continue your good work
Comment posted by k.bhavani on Friday, July 4, 2008 3:09 AM
can u insert codes of some important programmes
Comment posted by biswaranjan on Thursday, July 31, 2008 12:17 PM
plz give more qa on .net new versions .ie .net 3.0
which 'll be cover ajax ,linq &wcf etc
Comment posted by Vishwanath on Thursday, July 31, 2008 4:45 PM
Good one... Thanks for sharing it
Comment posted by Suprotim Agarwal on Friday, August 1, 2008 12:52 AM
Thanks everyone.

Biswaranjan: I have that on my list. I will post them in a few days.
Comment posted by Naushad Ali on Sunday, August 17, 2008 7:59 AM
These are the Question and Answere is very good.Thanks
Comment posted by Lakki on Monday, September 1, 2008 1:40 AM
Very good composition,we expects somemore
Comment posted by Avadhesh on Tuesday, September 2, 2008 1:52 AM
Very Helpfull, Thanks for sharing...
Comment posted by Anupama rawat on Friday, September 26, 2008 4:42 AM
I am a s/w developer This site is amazing.You can easily understand everything.You just try once i am defilnitely sure u will get everythng which u want.Thanx a ton dotnetcurry.for interview apects its really very good
Comment posted by Suprotim Agarwal on Friday, September 26, 2008 8:54 AM
:) Glad you liked them. You can check out some more FAQ's over here

Comment posted by ;'''''''''''''' on Friday, November 21, 2008 8:25 AM
Comment posted by dileep on Thursday, February 12, 2009 6:24 PM
Comment posted by Shahid Riaz Bhatti on Tuesday, March 17, 2009 1:29 PM
Well I read the following on this page:
"Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations."

I have a confusion. My thought was that new objects are created in Generation 0 and if the objects which survived from the GC aur promoted to higher generation. Am i right? If yes thn wat does it mean "The unreachable objects are placed in generation 0?". because it is not necessary that generation 0 objects are unreachable.
My concept regarding the reachable objects is that when the GC runs it find all the reachable objects in heap by using the roots which are generation by JIT.
Please help me to resolve this confusion. (i.e. Generation 0 have unreachable objects)
Comment posted by pp on Tuesday, April 28, 2009 8:06 AM
Answers r very lenthy , so in interview we should tell only in one sentence but u gave it is like mahabaratham
Comment posted by santosh kumar on Friday, September 11, 2009 1:51 PM
Hi Suprotim Agarwal,
Good collection , thanks for providing.

Comment posted by operatingSystem on Tuesday, November 3, 2009 5:12 AM
no comment plz
Comment posted by Alok Patoria on Saturday, December 26, 2009 5:13 AM
Really very easy to understand.but still I found some loopholes in terms of depth of the Topic.
Comment posted by Alok Patoria on Saturday, December 26, 2009 5:17 AM
can u just enhance the no of questions covering versions of .net,DLL, Event handling,Views,Datagrid, which are often asked by interviewers at fresher level.
Comment posted by Good One on Tuesday, March 9, 2010 9:45 PM
Good collection I must say .. I have also complied some on
.Net Framework 4.0
Check it out here
Comment posted by Subba reddy on Friday, June 11, 2010 6:21 AM
Good Collection.
But if u provide more number of questions and answers will be useful
Comment posted by sohan on Sunday, June 27, 2010 9:45 AM
please send interview realated questions of .net
Comment posted by Ganpat lal Oracle Developer. on Monday, June 28, 2010 8:29 AM
Thanks buddy.
Try more to upload best .net ques and ans.
Thank you to dotnetcurry..........
Comment posted by Ruksana Shaikh on Friday, August 13, 2010 5:55 AM
hey the site has broken link! click on Latest Articale link it gives me runtime server error!!
Comment posted by Carol on Friday, August 13, 2010 8:18 AM
Ruksana: I just tried the Latest article section and it works fine. Let me know if the error occurs again.
Comment posted by Nilesh Kale on Friday, August 27, 2010 1:06 PM
Good collection of questios and answers
Comment posted by bharath on Tuesday, November 23, 2010 3:40 AM
Good Collections
Comment posted by Raj Dube on Tuesday, November 23, 2010 9:27 AM
nice article

Comment posted by vinothkumar on Tuesday, December 21, 2010 4:59 AM
it is very nice.
Comment posted by Ramana reddymail.com on Monday, February 14, 2011 10:46 AM
thnks a lot for giving this collection its very helpful to me if u have more colletion about c sharp and asp pls attach to my mail id thanq for giving this questions
Comment posted by Anusha on Monday, March 14, 2011 12:30 PM
Thanks. It helped me a lot
Comment posted by Joya on Tuesday, March 15, 2011 4:02 AM
Check this article out

Comment posted by Sasireka on Thursday, April 28, 2011 9:19 AM
its very nice for beginners...
Comment posted by swati on Wednesday, May 4, 2011 7:32 AM
nice one
Comment posted by swatichoukhande on Wednesday, May 4, 2011 8:09 AM
Comment posted by ashok kumar on Thursday, May 19, 2011 11:59 PM
Very nice n structured material.Thanks a lot
Comment posted by Meenakshi on Tuesday, June 21, 2011 9:18 AM
will these questions will be good enough to crack the interview.... or do i need to go through some more articles... plzzzzz let me know and king send the some more related questions....

Comment posted by SH on Sunday, November 27, 2011 8:29 AM
Had I read it before I gone for Interview, I'd got a job in MNC. The same questions what they asked. However, I got in to another MNC with this. Very very nice information.
Comment posted by rafiq on Wednesday, January 25, 2012 7:50 AM
interested to work in your company
Comment posted by jai kumar on Thursday, February 16, 2012 10:57 AM
verrry useful thanks
Comment posted by Jhon on Monday, April 16, 2012 12:48 PM
Thanks... It is very helpful to me...
Comment posted by suraj pandey on Sunday, May 27, 2012 2:50 PM
this is really good. fresher get a way of interview and i had require this type of question.so thanks for developer of this site............
Comment posted by harika on Tuesday, July 10, 2012 7:39 AM
this is really good. fresher get a way of interview and i had require this type of question.so thanks for developer of this site............
Comment posted by mahesh on Wednesday, July 18, 2012 7:32 AM
really super........
Comment posted by karthik on Friday, July 27, 2012 6:28 AM
Best site to learn.
But i have a doubt what exactly framework?..................
Could you please explain in more detailed way..........plzzz..............
Comment posted by Pradeep Pharate on Monday, August 6, 2012 4:42 AM

nice information sir,

Comment posted by Pradeep Pharate on Monday, August 6, 2012 4:43 AM

nice information sir, Please any new new information send this mail in .NET

Comment posted by rishi00000 on Friday, September 28, 2012 5:47 AM
Its very nice for beginners. its very nice for beginners...
Comment posted by Tauseef on Saturday, October 13, 2012 5:54 PM
Excellent ,,,,,,,10 out of 10 .
Comment posted by Arun K Pandey on Tuesday, October 30, 2012 11:49 AM
Assembly is not a collection of .exe or DLLs. However an assembly can have a file extension of .exe or .dll. An assembly is a collection of types and resources grouped as their respective functionality.
Comment posted by Dheeraj on Tuesday, January 22, 2013 11:27 PM
Its really nice collection...

Comment posted by Bharti gogia on Tuesday, February 5, 2013 10:39 AM
One more web site for good interview questions on dot net and sql
Comment posted by Bharti gogia on Tuesday, February 5, 2013 10:40 AM
One more web site for good interview questions on dot net and sql visit interviewqsn.com
Comment posted by Arockia Raja on Wednesday, March 6, 2013 7:13 AM
Good interview questions
Comment posted by amit on Friday, March 15, 2013 2:17 PM
i like this site,,,,,its really works
Comment posted by rajan on Saturday, July 20, 2013 1:09 PM
i want to know good presentation and when hr say tell me about ur self so tha is attractive  and  asp net important question that asked in inteview
Comment posted by rajan on Saturday, July 20, 2013 1:09 PM
i want to know good presentation and when hr say tell me about ur self so tha is attractive  and  asp net important question that asked in inteview
Comment posted by Bhanu on Friday, August 2, 2013 3:44 AM
Very useful for me.
Comment posted by k venkateswaranaidu on Tuesday, September 3, 2013 2:00 AM
Comment posted by sugashini on Thursday, September 19, 2013 3:36 PM
Its really very useful
Comment posted by Pinkee on Tuesday, November 12, 2013 3:13 AM
•   What's the difference between overriding and overloading?
•   Explain what the StringBuilder class is and why you'd want to use it? And difference between string and stringbuilder?
•   What does the "override" and “new” keyword in C# mean, (in interface)?
•   Explain what happens when you pass a "ref" or "out" parameter into a method. What's the difference between those two keywords?
•   What's the difference between a left join and an inner join?
•   What's use of keyword using()? When would you will use?
•   What's the difference between a DataTable and a DataReader?
•   What's the difference between a value-type and a reference type?
•   What does the "readonly" keyword in C# mean?
•   Static, readonly and const difference?
•   What's the difference between a static method and a non-static method?
•   Whats the difference between an abstract class and interface? When would you will use them?
•   Singleton and single call
•   Httphandler and httpmodule
•   Asp.net page life cycle
•   Explain IIS lifecycle
•   What is Datacontext?
•   What is Garbage collection? How it works.
•   When and How to enforce garbage collector to run?
•   Use of finalize and Dispose?
•   What are IDisposable objects.
•   What's the difference between viewstate and sessionstate?
•   What is managed and unmanaged resources? What kind of object you can manually destroy from memory
•   How lifecycle of an object in stack works/who and how to destroy/release memory in stacks?
•   Early binding/late binding?
•   Explicit/implicit Interface implementation.
•   Different type of parameters in .net? (e.g. in/out/ref/param)
•   What is a postback and autoppostback?
•   Different state management techniques.
•   What is session. How to implement it.
•   Difference between authentication and authorization?
•   How you implemented authentication in your project?
•   What are the exception handling techniques in .net? can you use finally instead of catch with try.
•   Why we use ispostback?
•   Page_Load method, best use?
•   What way you can implement polymorphism in .net?
•   Type of inheritance?- Single level Inheritance,Hierarchical Inheritance,Multi Level Inheritance,Hybrid Inheritance,Multiple Inheritance etc. http://www.programcall.com/20/csnet/types-of-inheritance-in-csnet.aspx
•   Can you use multiple inheritance in .net?
•   Boxing/unboxing?
•   What is Globalization and localization in asp.net?
•   What is nullable types?
•   Difference between application domain and application pool.
•   Diference between Response.redirect, server.transfer?