Sie sind auf Seite 1von 9

1. Whats the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time its being operated on, a new instance is created.

2. Can you store multiple data types in System.Array? No.

. Whats the differen!e "et#een the System.Array.CopyTo$% and System.Array.Clone$%? The first one performs a deep copy of the array, the second one is shallow.

&. 'o# !an you sort the elements of the array in des!ending order? By calling Sort() and then e!erse() methods.

(. Whats "ashTable.

the

.)*T

datatype

that

allo#s

the

retrieval

of

data

"y

uni+ue

,ey?

-. Whats !lass Sorted.ist underneath? # sorted "ashTable.

/. $es.

Will finally "lo!,

get

exe!uted

if

the

ex!eption

had

not

o!!urred?

0. Whats the C1 e+uivalent of C22 !at!h $3%4 #hi!h #as a !at!h5all statement for any possi"le ex!eption? # catch bloc% that catches the exception of type System.&xception. $ou can also omit the parameter data type in this case and 'ust write catch ().

6. Can multiple !at!h "lo!,s "e exe!uted? No, once the proper catch code fires off, the control is transferred to the finally bloc% (if there are any), and then whate!er follows the finally bloc%.

17. Why is it a "ad idea to thro# your o#n ex!eptions? *ell, if at that point you %now that an error has occurred, then why not write the proper code to handle that error instead of passing a new &xception ob'ect to the catch bloc%+ Throwing your own exceptions signifies some design flaws in the pro'ect.

11. Whats a delegate?

# delegate ob'ect encapsulates a reference to a method. ,n -.. they were referred to as function pointers.

12. Whats a ,ts a delegate that points to and e!entually fires off se!eral methods.

multi!ast

delegate?

1 . 'o#s the 8.. 'ell pro"lem solved in .)*T? #ssembly !ersioning allows the application to specify not only the library it needs to run (which was a!ailable under *in/0), but also the !ersion of the assembly.

1&. What are the #ays to deploy an assem"ly? #n 1S, installer, a -#B archi!e, and 2-34$ command.

1(. Whats a satellite assem"ly? *hen you write a multilingual or multi5cultural application in .N&T, and want to distribute the core application separately from the locali6ed modules, the locali6ed assemblies that modify the core application are called satellite assemblies.

1-. What namespa!es are ne!essary to !reate a lo!ali9ed appli!ation? System.7lobali6ation, System. esources.

1/. Whats the differen!e "et#een :: !omments4 :; ;: !omments and ::: !omments? Single5line, multi5line and 218 documentation comments.

10. 'o# do you generate do!umentation from the C1 file !ommented properly #ith a !ommand5line !ompiler? -ompile it with a 9doc switch.

16. Whats the differen!e "et#een <!= and <!ode= >?. do!umentation tag? Single line code example and multiple5line code example.

27. @s >?. !ase5sensitive? $es, so :Student; and :student; are different elements.

21. What de"ugging tools !ome #ith the .)*T S8A?

-or<B7 = command5line debugger, and <bg-8 = graphic debugger. >isual Studio .N&T uses the <bg-8 . To use -or<bg, you must compile the original -? file using the 9debug switch.

22. What does the This #indo# sho# in the de"ugger? ,t points to the ob'ect thats pointed to by this reference. 3b'ects instance data is shown.

2 . What are three test !ases you should go through in unit testing? 4ositi!e test cases (correct data, correct output), negati!e test cases (bro%en or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).

2&. What does assert$% do? ,n debug compilation, assert ta%es in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

2(. Why are there five tra!ing levels in System.8iagnosti!s.Tra!eS#it!her? The tracing dumps can be @uite !erbose and for some applications that are constantly running you run the ris% of o!erloading the machine and the hard dri!e there. Ai!e le!els range from None to >erbose, allowing to fine5tune the tracing acti!ities.

2-. Where is the output of TextWriterTra!e.istener redire!ted? To the -onsole or a text file depending on the parameter passed to the constructor.

2/. 'o# do you de"ug an ASB.)*T We" appli!ation? #ttach the aspnetBwp.exe process to the <bg-lr debugger.

20. Whats the differen!e "et#een the 8e"ug !lass and Tra!e !lass? <ocumentation loo%s the same. Cse <ebug class for debug builds, use Trace class for both debug and release builds.

26. Can you !hange the value of a varia"le #hile de"ugging a C1 appli!ation? $es, if you are debugging !ia >isual Studio.N&T, 'ust go to immediate window.

7. *xplain the three servi!es model $three5tier appli!ation%. 4resentation (C,), business (logic and underlying code) and data (from storage or other sources).

1. What are advantages and disadvantages of ?i!rosoft5provided data provider !lasses in A8C.)*T? SD8Ser!er.N&T data pro!ider is high5speed and robust, but re@uires SD8 Ser!er license purchased from 1icrosoft. 38&5<B.N&T is uni!ersal for accessing other sources, li%e 3racle, <B0, 1icrosoft #ccess and ,nformix, but its a .N&T layer on top of 38& layer, so not the fastest thing in the world. 3<B-.N&T is a deprecated layer pro!ided for bac%ward compatibility to 3<B- engines.

2. Whats the role of the 8ataDeader !lass in A8C.)*T !onne!tions? ,t returns a read5only dataset from the data source when the command is executed.

. What is the #ild!ard !hara!ter in SE.? 8ets say you want to @uery database with 8,E& for all employees whose name starts with 8a. The wildcard character is F, the proper @uery with 8,E& would in!ol!e G8aF.

&. *xplain AC@8 rule of thum" for transa!tions. Transaction must be #tomic (it is one unit of wor% and does not dependent on pre!ious and following transactions), -onsistent (data is either committed or roll bac%, no Hin5betweenI case where something has been updated and something hasnt), ,solated (no transaction sees the intermediate results of the current transaction), <urable (the !alues persist if the data had been committed e!en if the system crashes right after).

(. What !onne!tions does ?i!rosoft SE. Server support? *indows #uthentication (!ia #cti!e <irectory) and SD8 Ser!er authentication (!ia 1icrosoft SD8 Ser!er username and passwords).

-. Whi!h one is trusted and #hi!h one is untrusted? *indows #uthentication is trusted because the username and password are chec%ed with the #cti!e <irectory, the SD8 Ser!er authentication is untrusted, since SD8 Ser!er is the only !erifier participating in the transaction.

/. Why #ould you use untrusted verifi!aion? *eb Ser!ices might use it, as well as non5*indows applications.

0. What does the parameter @nitial Catalog define inside Conne!tion String? The database name to connect to.

6. Whats the data provider name to !onne!t to A!!ess data"ase? 1icrosoft.#ccess.

&7. What does 8ispose method do #ith the !onne!tion o"Fe!t? <eletes it from the memory.

&1. What is a pre5re+uisite for !onne!tion pooling? 1ultiple processes must agree that they will share the same connection, where e!ery parameter is the same, including the security settings.

&2. Whats the impli!it name of the parameter that gets passed into the !lass set method? >alue, and its datatype depends on whate!er !ariable were changing.

& . 'o# do you inherit from a !lass in C1? 4lace a colon and then the name of the base class.

&&. 8oes C1 support multiple inheritan!e? No, use interfaces instead.

&(. When you inherit a prote!ted !lass5level varia"le4 #ho is it availa"le to? -lasses in the same namespace.

&-. Are private !lass5level varia"les inherited? $es, but they are not accessible, so loo%ing at it you can honestly say that they are not inherited. But they are.

&/. Whats the top .)*T !lass that everything is derived from? System.3b'ect.

&0. 'o#s method overriding different from overloading? *hen o!erriding, you change the method beha!ior for a deri!ed class. 3!erloading simply in!ol!es ha!ing a method with the same name within the class.

&6. What does the ,ey#ord virtual mean in the method definition? The method can be o!er5ridden.

(7. Can you de!lare the override method stati! #hile the original method is non5stati!? No, you cant, the signature of the !irtual method must remain the same, only the %eyword !irtual is changed to %eyword o!erride.

(1. Can you override private virtual methods? No, moreo!er, you cannot access pri!ate methods in inherited classes, ha!e to be protected in the base class to allow any sort of access.

(2. Can you allo# !lass to "e inherited4 "ut prevent the method from "eing over5ridden? $es, 'ust lea!e the class public and ma%e the method sealed.

( . Whats an interfa!e !lass? ,ts an abstract class with public abstract methods all of which must be implemented in the inherited classes.

(&. Can you inherit multiple interfa!es? $es, why not.

((. And if they have !onfli!ting method names? ,ts up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher5le!el scale if similarly named methods from different interfaces expect different data, but as far as compiler cares youre o%ay.

(-. Whats the differen!e "et#een an interfa!e and a"stra!t !lass?

,n the interface all methods must be abstract, in the abstract class some methods can be concrete. ,n the interface no accessibility modifiers are allowed, which is o% in abstract classes.

(/. 'o# !an you overload a method? <ifferent parameter data types, different number of parameters, different order of parameters.

(0. @f a "ase !lass has a "un!h of overloaded !onstru!tors4 and an inherited !lass has another "un!h of overloaded !onstru!tors4 !an you enfor!e a !all from an inherited !onstru!tor to an ar"itrary "ase !onstru!tor? $es, 'ust place a colon, and then %eyword base (parameter list to in!o%e the appropriate constructor) in the o!erloaded constructor definition inside the inherited class.

(6. @s it namespa!e !lass or !lass namespa!e? The .N&T class library is organi6ed into namespaces. &ach namespace contains a functionally related group of classes so natural namespace comes first.

-7. Where is a prote!ted !lass5level varia"le availa"le? ,t is a!ailable to any sub5class deri!ed from base class

-1. Are private !lass5level varia"les inherited? $es, but they are not accessible.

-2. 8es!ri"e the a!!essi"ility modifier Gprote!ted internalH. ,t is a!ailable to classes that are within the same assembly and deri!ed from the specified base class.

- . What does the term immuta"le mean? The data !alue may not be changed. NoteJ The !ariable !alue may be changed, but the original immutable data !alue was discarded and a new data !alue was created in memory.

-&. What is the syntax to inherit from a !lass in C1? 4lace a colon and then the name of the base class. &xampleJ class 1yNew-lass J 1yBase-lass

-(. Can you prevent your !lass from "eing inherited "y another !lass? $es. The %eyword HsealedI will pre!ent the class from being inherited.

--. Can you allo# a !lass to "e inherited4 "ut prevent the method from "eing over5ridden? $es. Kust lea!e the class public and ma%e the method sealed.

-/. Whats an a"stra!t !lass? # class that cannot be instantiated. #n abstract class is a class that must be inherited and ha!e the methods o!erridden. #n abstract class is essentially a blueprint for a class without any implementation.

-0. When do you a"solutely have to de!lare a !lass as a"stra!t? L. *hen the class itself is inherited from an abstract class, but not all base abstract methods ha!e been o!erridden. 0. *hen at least one of the methods in the class is abstract.

-6. What is an interfa!e !lass? ,nterfaces, li%e classes, define a set of properties, methods, and e!ents. But unli%e classes, interfaces do not pro!ide implementation. They are implemented by classes, and defined as separate entities from classes.

/7. Why !ant you spe!ify the a!!essi"ility modifier for methods inside the interfa!e? They all must be public, and are therefore public by default.

/1. What happens if you inherit multiple interfa!es and they have !onfli!ting method names? ,ts up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher5le!el scale if similarly named methods from different interfaces expect different data, but as far as compiler cares youre o%ay.

/2. What is the differen!e "et#een a Stru!t and a Class? Structs are !alue5type !ariables and are thus sa!ed on the stac%, additional o!erhead but faster retrie!al. #nother difference is that structs cannot inherit.

/ . What does the ,ey#ord GvirtualH de!lare for a method or property? The method or property can be o!erridden.

/&. 'o# is method overriding different from method overloading? *hen o!erriding a method, you change the beha!ior of the method for the deri!ed class. 3!erloading a method simply in!ol!es ha!ing another method with the same name within the class.

/(. Can you de!lare an override method to "e stati! if the original method is not stati!? No. The signature of the !irtual method must remain the same. (NoteJ 3nly the %eyword !irtual is changed to %eyword o!erride)

/-. What are the different #ays a method !an "e overloaded? <ifferent parameter data types, different number of parameters, different order of parameters.

//. @f a "ase !lass has a num"er of overloaded !onstru!tors4 and an inheriting !lass has a num"er of overloaded !onstru!torsI !an you enfor!e a !all from an inherited !onstru!tor to a spe!ifi! "ase !onstru!tor? $es, 'ust place a colon, and then %eyword base (parameter list to in!o%e the appropriate constructor) in the o!erloaded constructor definition inside the inherited class.

Das könnte Ihnen auch gefallen