You are on page 1of 13

.

NET Framework Interview Questions


Number: Heading: Question: Answer: Comments: Level: E! E!TL 1 .NET Generic What is CLR? The CLR is the execution engine for .NET framework applications.

Number: Heading: Question: Answer:

" .NET Generic What are the ser#ices pro#i$e$ %& CLR? Co$e 'anagement( )pplication 'emor& *solation( +erification of t&pe safet&( Nati#e co$e con#ersion( 'anaging memor& for o%,ects( Enforcement of C) -Co$e )ccess ecurit&.( Exception han$ling( *nterop -C/' an$ Win0".( 1rofiling( 2e%ugging )nswer ma& not necessaril& contain all the info. E! E!TL

Comments: Level:

Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer: Comments: Level:

0 .NET Generic What is CT ? Commom T&pe &stem. This is the range of t&pes that .NET runtime -CLR. un$erstan$s. E! 3 .NET Generic What is CL ? Commom Language pecification. This is the su%set of CT ( which all .NET languages must support. E! E!TL E!TL

Number: Heading:

4 .NET Generic

.NET Framework Interview Questions


Question: Answer: What is a$#antage of CL ? The i$ea is that an& program which uses CL complaint can interoperate with an& .NET program written in an& other language. 5or example( allowing a +6.NET class to $eri#e from a C7 class. E! E!TL

Comments: Level:

Number: Heading: Question: Answer:

8 .NET Generic What is ' *L? 'icrosoft *nterme$iate Language. )ll .NET source co$e is con#erte$ to *L co$e after compilation. The *L is con#erte$ to nati#e co$e at the point where the software is installe$( or runtime %& 9ust:*n:Time Compiler. E! E!TL

Comments: Level:

Number: Heading: Question: Answer: Comments: Level:

; .NET Generic What is <manage$=co$e? )ll the co$e that target CLR is manange$ co$e i.e instance -or. o%,ect management is taken care %& the CLR through Gar%age Collection. E! E!TL

Number: Heading: Question: Answer:

> .NET Generic What is an )ssem%l&? )n assem%l& is $escri%e$ as logical unit( which can %e 2LL or E?E( consists .NET 5ramework t&pes as well as resources-%itmaps( etc.. )ssem%lies can %e static or $&namic. E! @ .NET Generic What is 'eta$ata? )part from containing T&pes( an assem%l& also contains information a%out the E!TL

Comments: Level: Number: Heading: Question: Answer:

.NET Framework Interview Questions


t&pes itself such as name( fiel$s an$ metho$s an$ its parameters of the t&pes. This is calle$ meta$ata. Comments: Level: E! E!TL

Number: Heading: Question: Answer: Comments: Level:

1A .NET Generic What is 'anifest? )n assem%l& ma& also contain references to their assem%lies. These resources( t&pes an$ references are $escri%e$ in a %lock calle$ manifest. E! E!TL

Number: Heading: Question: Answer:

11 .NET Generic What is an )pp2omain? )n )pp2omain can %e thought of as a lightweight process. 'ultiple )pp$omains can coexist insi$e a Win0" 1rocess. The primar& purpose of the )pp$omain is to isolate an application from other application. E! E!TL

Comments: Level:

Number: Heading: Question: Answer: Comments: Level:

1" .NET Generic What is Gar%age Collection? Gar%age Collection is a ser#ice pro#i$e$ %& CLR( which take responsi%ilit& for managing lifetime of o%,ects( an$ heap memor& the& occup&. E! E!TL

Number: Heading: Question: Answer: Comments: Level:

10 .NET Generic What is tool pro#i$e$ %& ' to #iew *L? *L2) ' can %e use$ to #iew the meta$ata an$ *L for an assem%l&. E! E!TL

.NET Framework Interview Questions

Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer: Comments: Level:

13 .NET Generic Bow can * access the Win0" )1* from .NET 5ramwork? We can access using 1!*n#o$e -1rocess *n#oke. machanism. E! 14 .NET Generic Can we access C/' components from .NET 5ramwork? Ces( we can access C/' from .NET using RCW -Runtime Calla%le Wrapper.. )nswer ma& not necessaril& contain the wor$ <RCW=. E! E!TL E!TL

Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer: Comments: Level:

18 .NET Generic Can we access .NET components from C/'? Ces( we can access .NET from C/' using CCW -C/' Calla%le Wrapper.. )nswer ma& not necessaril& contain the wor$ <CCW=. E! 1; .NET Generic Can we access C/' components from .NET 5ramwork? Ces( we can access C/' using RCW -Runtime Calla%le Wrapper.. )nswer ma& not necessaril& contain the wor$ <RCW=. E! 1> .NET Generic What is i$e:%&: i$e execution? *t is the a%ilit& to run multiple #ersions of the same assem%l& simultaneousl& on the same machine or e#en in the same process. E! E!TL E!TL E!TL

Number:

1@

.NET Framework Interview Questions


Heading: Question: Answer: Comments: Level: E! E!TL .NET Generic What are the $ifferent CLR hosts pro#i$e$ .NET 5ramework? ) 1.NET( ' *nternet Explorer( hell Executa%les

Number: Heading: Question: Answer: Comments: Level:

"A .NET Generic What are the $ifferent ecurit& mechanisms a#aila%le in .NET? ) 1.NET We% )pplication ecurit&( Co$e )ccess ecurit& an$ Role 6ase$ ecurit& E! E!TL

Number: Heading: Question: Answer: Comments: Level:

"1 .NET Generic What is non:$eterministic $estruction? GC offers no guarantees a%out the time when an o%,ect will %e $estro&e$ an$ manage$ heap will %e reclaime$. E! E!TL

Number: Heading: Question: Answer:

"" .NET Generic *s the lack of $eterministic $estruction pro%lem in .NET? *ts $efinitel& a pro%lem that affects component $esign. *f &ou ha#e o%,ects that maintain expensi#e or scarce resources -exD file han$les( $% conn( etc.( we nee$ to pro#i$e some wa& for the client to inform the o%,ect to release the resources. *2ispose can %e use$ for this purpose. E! E!TL

Comments: Level:

Number: Heading: Question:

"0 .NET Generic What is the $efault namespace that gets importe$ in e#er& .NET program? E

.NET Framework Interview Questions


Wh&? Answer: Comments: Level: E! E!TL &stem namespace. This is where the root class &stem./%,ect of .NET 6CL is present. )ll user $efine$ classes implicitl& $eri#e$ from this class.

Number: Heading: Question: Answer: Comments: Level:

"3 .NET Generic What are the $ifferent common namespaces a#aila%le in .NET 5ramework? &stem( &stem.Text( &stem.Collections( &stem.*/( &stem.2iagnostics( &stem.?ml( &stem.Reflection( etc. E! E!TL

Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer:

"4 .NET Generic What is erialiFation? *t is a process of con#erting an o%,ect into a stream of %&tes. 2eserialiFation is the opposite process of creating an o%,ect from the stream of %&tes. E! "8 .NET Generic 2oes the .NET ha#e %uilt:in support for serialiFation? There are two separate mechanisms pro#i$e$ %& .NET class li%rar&( ?ml erialiFer for ?'L %ase$ serialiFation an$ oap5ormatter!6inar&5ormatter for run:time %ase$ serialiFation. E! E!TL E!TL

Comments: Level:

Number: Heading: Question: Answer:

"; .NET Generic * want to serialiFe m& class. Which shoul$ * use? ?ml erialiFer( oap!6inar& formatter? *t $epen$s. ?ml erialiFer has se#ere limitations such as the reGuirement that the target class has a parameterless constructor( an$ onl& pu%lic rea$!write fiel$s can %e serialiFe$. ?ml erialiFation is most suita%le for cross:platform work.

.NET Framework Interview Questions

oap!6inar& formatters ha#e fewer limitations like the& can serialiFe pri#ate fiel$s. There are some issues like when $eserialiFation the target classHs constructer wont get in#oke$. Comments: Level: E! E!TL

Number: Heading: Question: Answer:

"> .NET Generic What are attri%utes? There are two t&pes of attri%utes. The first is meta$ata attri%uteI it allows some $ata to %e attache$ to the metho$!class!fiel$. This $ata %ecomes part of meta$ata for the t&pe an$ can %e accesse$ #ia reflection. The other t&pe is context attri%ute. Context attri%utes pro#i$e an interception machanism where%& intance acti#ation an$ metho$ calls can %e pre!post processe$.

Comments: Level: Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer: E! 0A .NET Generic What are the $ifferences %etween pri#ate an$ share$ assem%lies? ) pri#ate assem%l& is normall& use$ %& a single application an$ is store$ in the applicationHs $irector&( or a su%:$irector& %eneath. ) share$ assem%l& is normall& store$ in Glo%al )ssem%l& Cache. The runtime enforces #ersioning constraints onl& on share$ assem%lies an$ not on pri#ate assem%lies. Comments: Level: E! E!TL E!TL E! "@ .NET Generic What are the t&pes of assem%lies? 1ri#ate )ssem%lies( hare$ )ssem%lies an$ atellite assem%lies E!TL

Number:

01

.NET Framework Interview Questions


Heading: Question: Answer: .NET Generic What are reGuirements for an assem%l& to store in G)C? The assem%l& shoul$ %e a strongl& name$ assem%l&. ) strong name consists of assem%l&Hs i$entit& J its simple name with out extension( four:part #ersion num%er( culture info if pro#i$e$( plus a pu%lic ke& an$ $igital signature. E! E!TL

Comments: Level:

Number: Heading: Question: Answer:

0" .NET Generic What are the wa&s to install an assem%l& into G)C? /ne is to use Win$ows *nstaller. *t is recommene$ wa& of $oing on the pro$uction en#ironments. /ther wa& is to use <gacutil= pro#i$e$ %& .NET framework. <gacutil= shoul$ not %e use$ in pro$uction en#ironments. E! 00 .NET Generic What is Co$e )ccess ecurit&? C) is a part of .NET ecurit& mo$el that $etermines whether or not a piece of co$e is allowe$ to run( an$ what resources it can use when running. E! E!TL E!TL

Comments: Level: Number: Heading: Question: Answer: Comments: Level:

Number: Heading: Question: Answer:

03 .NET Generic Bow $oes C) work?? The C) re#ol#es aroun$ two ke& concepts J co$e groups an$ permissions. Each .NET assem%l& is a mem%er of a particular co$e group an$ each co$e group is grante$ permissions specifie$ in name$ permission set. E! E!TL

Comments: Level:

Number: Heading: Question: Answer:

04 .NET Generic Who $efines C) co$e groups?? 'icrosoft $efines some $efault ones( %ut we can mo$if& an$ e#en create our own. To see the co$e groups $efine$ on &our s&stem( run <caspol Jlg= from comman$ prompt.

.NET Framework Interview Questions


Comments: Level: E! E!TL

Number: Heading: Question: Answer:

08 .NET Generic Who $efines C) co$e groups?? 'icrosoft $efines some $efault ones( %ut we can mo$if& an$ e#en create our own. To see the co$e groups $efine$ on &our s&stem( run <caspol Jlg= from comman$ prompt. E! E!TL

Comments: Level:

Number: Heading: Question: Answer: Comments: Level:

0; .NET Generic Bow $o * rea$ from a Text file? 5irst use &stem.*/.5ile tream to open a file. Then we can use treamRea$er class to rea$ the file line %& line. 5inall& close the stream. E! E!TL

Number: Heading: Question: Answer: Comments: Level:

0> .NET Generic Bow $o * write to a Text file? We can write to a file using treamWriter. E! E!TL

Number: Heading: Question: Answer: Comments: Level:

0> .NET Generic Bow $o * rea$!write %inar& files? imilar to text files( except wrap the 5ile tream o%,ect with 6inar&Rea$er!6inar&Writer o%,ect. E! E!TL

.NET Framework Interview Questions

Number: Heading: Question: Answer: Comments: Level: Number: Heading: Question: Answer:

0@ .NET Generic )re Regular Expression supporte$ in .NET? What is the namespace of Regular Expressions? Ces. We ha#e to use &stem.Text.RegularExpressions namespace. E! 3A .NET Generic What t&pes of arra&s supporte$ %& .NET? Bow $o &ou $eclare an arra&? ingle:$imentional( 'ulti:$imentional an$ 9agge$ )rra&s &stem.*nt0"KL intsI !!$eclare *nts M new &stem.*nt0"-1AA.I !!create E! E!TL E!TL

Comments: Level:

Number: Heading: Question: Answer:

31 .NET Generic What t&pes of arra&s supporte$ %& .NET? Bow $o &ou $eclare an arra&? ingle:$imentional( 'ulti:$imentional an$ 9agge$ )rra&s &stem.*nt0" KL intsI !!$eclare *nts M new &stem.*nt0" -1AA.I !!create E! E!TL

Comments: Level:

Number: Heading: Question:

3" .NET Generic *f &ou $efine a metho$ that is to return a reference to an arra& an$ that arra& has no elements in it( then woul$ &ou return <null= or a reference to arra& with Fero elements in it?? Return Fero:length arra&( %ecause it simpliflies co$e that a $e#eloper calling must write. ExD )ppts KL appts M Get)ppts -.I for-*nt0" i M AI i M appts.LengthI i N 1.

Answer:

.NET Framework Interview Questions


OP Comments: Level: E!TL

Number: Heading: Question:

3" What are 2elegates? Bow to use them? 2elagtes is a wa& to implement call%ack machanism in .NET. The a$#antage of .NET 2elegates is that it is t&pe:safe. pu%lic #oi$ $elegate a$$-int a( int%.I

Answer: Comments: Level: E! E!TL

Number: Heading: Question:

30 Bow $o * spawn a threa$? Create an instance of &stem.Threa$ing.Threa$ o%,ect( passing it an instance of Threa$ tart $elegate that will %e execute$ on a new threa$. Threa$ thr$ M new Threa$ - new Threa$ tart-somefnref. .I rhr$. tart-.I

Answer: Comments: Level: E!TL

Number: Heading: Question:

33 Bow $o * use the threa$ pool? 6& passing an instance of a WaitCall%ack $elegate to the Threa$1ool.QueueRserWork*tem metho$D Threa$1ool.QueueRserWork*tem -new WaitCall%ack -somefunref..I

Answer: Comments:

.NET Framework Interview Questions


Level: E!TL

Number: Heading: Question:

34 Bow $o * pre#ent concurrent access to m& $ata? Each o%,ect has a concurrenc& lock -critical section. associate$ with it. The &stem.Threa$ing.'onitor.Enter!Exit metho$s are use$ to acGuire an$ release the lock. Class c O pu%lic #oi$ f-. O tr& O 'onitor.Enter-this.I P finall& O 'onitor.Exit-this.I P P -/R. simpl& &ou coul$ use the <lock= ke&wor$. Class c O pu%lic #oi$ f-. O lock-this. O P P P

Answer: Comments: Level: E!TL

Number: Heading: Question: Answer:

38 What is a collection? What are the generic collections a#aila%le in .NET? ) collection is a set of similarl& t&pe$ o%,ects groupe$ together. The )rra&( )rra&List( Bashta%le( orte$List( Queue( tack are the generic collections a#aila%le in .NET.

Comments:

.NET Framework Interview Questions


Level: Number: Heading: Question: Answer: What is an enumerator? Bow to use them? *t is an o%,ect that iterates through its associate$ collection. )n enumerator can %e associate$ with onl& one collection( %ut a collection can ha#e multiple enumerators. Cou can use either use <*Enumera%le.GetEnumerator= or simple can use <foreach= to loop through collection. Comments: Level: Number: Heading: Question: Answer: What is %oxing an$ un%oxing? 6oxing is the process of con#erting a #alue t&pe to a reference t&pe. *t has some o#erhea$. Rn%oxing is the re#erse process of con#erting reference t&pe to #alue t&pe. E! 3@ What is Reflection an$ its purpose? Reflection namespace allow &ou to o%tain information a%out loa$e$ assem%lies an$ t&pes within them( such as classes( interfaces an$ #alue t&pes. Cou can also create t&pe instances at runtime using reflection an$ also can in#oke an$ access them. E!TL 4A )n instance of &stem.Text. tring is immuta%le? What $oes it mean? *t is immuta%le %ecause its #alue canHt %e mo$ifie$ once it has %een create$. 'etho$s that mo$if& instances of tring actuall& return new tring instances. We ha#e to use tring6uil$er class if it is necessar& to actuall& mo$if& the contents of a string like o%,ect. E! E!TL E!TL 3> E!TL 3; E!TL

Comments: Level: Number: Heading: Question: Answer:

Comments: Level: Number: Heading: Question: Answer:

Level:

You need more technical questions and programmes, visit www.blog.selvaa.com

You might also like