uptu mca512 university papaer solution year 2014_15

Upload: krishna-kumar-singh

Post on 02-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    1/18

    AJAY KUMAR GARG ENGINEERING COLLEGE GHAZIABAD

    DEPARTMENT OF MCA

    Model Solution Uni!e"#it$ Te#t

    Course: MCA Semester: V

    Session: 2014-15 Section: A+B

    Subject: .Net Frameor! " C# Sub. Co$e: MCA-512Ma% Mar!s: 100 &ime: '()

    %&Atte'(t )n$ *ou" +ue#tion# ,-./0123

    %,)3 Enu'e")te ')4o" #e"!i5e# t6e CLR& 7-8

    ANS9&*e rimar, roe o t*e C/) is to ocate oa$ an$ manae .N& t,es on ,our be*a.

    3 &*e C/) aso ta!es care o a number o o-ee $etais suc* as memor, manaement

    aication *ostin

    *an$in t*rea$s an$ erormin arious securit, c*ec!s.

    T6e CLR ("o!ide# ) nu':e" o* #e"!i5e# t6)t in5lude9

    /oa$in an$ e%ecution o co$es

    Memor, isoation or aication

    Veriication o t,e saet,

    Comiation o 6/ into natie e%ecutabe co$e

    7roi$in meta$ata

    Automatic arbae coection

    norcement o Securit, 6nteroerabiit, it* ot*er s,stems

    Manain e%cetions an$ errors

    7roi$e suort or $ebuin an$ roiin

    %,:3 De*ine inte";o(e"):ilit$& Ho< doe# Net *")'e 7-8

    ANS96nteroerabiit, enabes ,ou to resere an$ ta!e a$antae o e%istin inestments inunmanae$ co$e. Co$e t*at runs un$er t*e contro o t*e common anuae runtime 8C/)9 is cae$

    manae$ co$e an$ co$e t*at runs outsi$e t*e C/) is cae$ unmanae$ co$e. CM CM+ C++

    comonents Actie; comonents an$ Microsot // an$ t*e coman, t*at rote t*e >// isn=t a$otin .N& as ?uic!,

    as ,our coman, is. 6n t*is case ,ou sti nee$ to ca into t*at >// rom a .N& aication.

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    2/18

    3 M)n)?ed 5ode u#in? COM 5o'(onent# You mi*t aso nee$ to continue suortin CM

    comonents. @ou $o t*is b, creatin a .N& raer or t*e CM comonent so t*at t*e

    manae$ cient t*in!s it=s or!in it* a .N& cass.3 Un')n)?ed 5ode u#in? &NET #e"!i5e#@ou ant to access .N& rom unmanae$ co$e. 6t=s

    soe$ usin a reciroca aroac*: a CM cient is ooe$ into t*in!in it=s usin a CM

    serer *ic* is actua, a .N& serice o some sort.

    %,53 Di#5u## CLR )5ti!itie# *o" ("o?")' e.e5ution

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    3/18

    &*e manae$ co$e is aa,s e%ecute$ b, a manae$ runtime e%ecution enironment rat*er

    t*an t*e oeratin s,stem $irect,. Manae$ reers to a met*o$ o e%c*anin inormation

    beteen t*e roram an$ t*e runtime enironment.

    Because t*e e%ecution o co$e is oerne$ b, t*e runtime enironment t*e enironment can

    uarantee *at t*e co$e is oin to $o an$ roi$e t*e necessar, securit, c*ec!s beore

    e%ecutin an, iece o co$e. Because o t*e same reason t*e manae$ co$e aso ets $ierentserices rom t*e runtime enironment i!e Garbae Coection t,e c*ec!in e%cetion*an$in boun$s c*ec!in etc. &*is a, manae$ co$e $oes not *ae to orr, about memor,

    aocations t,e saet, etc.

    Aications ritten in aa C# VB.N& etc taret a runtime enironment *ic* manaes

    t*e e%ecution an$ t*e co$e ritten usin t*ese t,es o anuaes is !non as Manae$ Co$e.

    Manae$ co$e is aa,s comie$ into an 6nterme$iate /anuae 8MS6/ in case o .N&

    Frameor!9. &*e comier use$ b, .N& rameor! to comie manae$ co$e comies it into

    6nterme$iate /anuae an$ enerates t*e necessar, meta$ata s,mboic inormation t*at$escribes a o t*e entr, oints an$ t*e constructs e%ose$ in t*e 6nterme$iate /anuae 8e..

    met*o$s roerties9 an$ t*eir c*aracteristics.

    &*e Common /anuae 6nrastructure 8C/69 Stan$ar$ $escribes *o t*e inormation is to beenco$e$ an$ rorammin anuaes t*at taret t*e runtime emit t*e correct enco$in.

    Manae$ co$e aso roi$es atorm in$een$ence. As t*e manae$ co$e is irst comie$ to

    interme$iate anuae t*e C/)Hs 6& Comier ta!es care o comiin t*is interme$iate

    anuae into t*e arc*itecture seciic instructions.

    Un')n)?ed Code

    Co$e t*at is $irect, e%ecute$ b, t*e eratin S,stem is !non as un-manae$ co$e.

    &,ica, aications ritten in VB .0 C++ C etc are a e%ames o unmanae$ co$e.

    nmanae$ co$e t,ica, tarets t*e rocessor arc*itecture an$ is aa,s $een$ent on t*e

    comuter arc*itecture.

    nmanae$ co$e is aa,s comie$ to taret a seciic arc*itecture an$ i on, run on t*einten$e$ atorm. &*is means t*at i ,ou ant to run t*e same co$e on $ierent arc*itecture

    t*en ,ou i *ae to recomie t*e co$e usin t*at articuar arc*itecture.

    nmanae$ co$e is aa,s comie$ to t*e natie co$e *ic* is arc*itecture seciic. Ho< it i# u#in? in 5onne5tion

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    4/18

    Ju#t;In;ti'e Co'(il)tion

    &*e .Net anuaes *ic* is conorms to t*e Common /anuae Seciication 8C/S9 uses its

    correson$in runtime to run t*e aication on $ierent eratin S,stems . >urin t*e co$ee%ecution time t*e Manae$ Co$e comie$ on, *en it is nee$e$ t*at is it conerts t*e

    aroriate instructions to t*e natie co$e or e%ecution just beore *en eac* unction is cae$.

    &*is rocess is cae$ ust 6n &ime 86&9 comiation aso !non as >,namic &ransation .

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    5/18

    O

    cass &riane:S*aeJubic oerri$e $oube Area89

    J

    return 8.5P%P,9KO

    Ocass )ectane:S*aeJ

    ubic ne $oube Area89

    J

    return 8P%P,9KO

    O

    ubic cass Main&est

    Jubic static oi$ Main89

    JS*ae trine &riane89K

    S*ae rectne )ectane89K

    tri.Set89Consoe.e8strin str9K

    2. >ecare a met*o$ it* t*e same sinature as t*e $eeate.

    static oi$ Noti,8strin name9

    J Consoe.

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    6/18

    6nstantiate >e b, usin an anon,mous met*o$.

    >e $e' $eeate8strin name9

    J Consoe.e b, usin a amb$a e%ression.

    >e $e4 name R J Consoe.eeate8int num1 int num29K

    static oi$ Main8strinT ars9 J

    A$$>eeate unct1 ne A$$>eeate8A$$9K

    int !unct18D29K

    Consoe.

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    7/18

    J

    et

    J return8rea9K

    O

    set J

    rea aueK

    O O

    ubic oat 6mainar,

    J et

    J

    return8imainar,9K

    O set

    J imainar, aueK

    O

    O

    ubic oerri$e strin &oStrin89

    J

    return8Strin.Format8Q8J0O J1Oi9Q rea imainar,99K O

    ubic static boo oerator8Come% c1 Come% c29 J

    i 88c1.rea c2.rea9 "" 8c1.imainar, c2.imainar,99

    return8true9K ese

    return8ase9K

    O

    ubic static boo oeratorU8Come% c1 Come% c29

    J

    return8U8c1 c299K O

    ubic oerri$e boo ?uas8object o29 J

    Come% c2 8Come%9 o2K

    return8t*is c29K

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    8/18

    O

    O

    cass MainCassJ

    ubic static oi$ Main89

    J Come% c1 ne Come%8' 19K

    Come% c2 ne Come%81 29K

    Consoe. "ite ) ("o?")' in Cit to 5o($ t6e d)t) *"o' one *ile

    to )not6e"& 7%28

    ANS9Stream is an object *ic* is use$ to transer t*e $ata. e *ae ie streaminmemor, streamin

    etc. Stream is an abstract cass.&*ere is a eneric stream cassS,stem.6.Stream rom *ic* a streams are $erie$. )ea$er

    riter streams suc* as Stream)ea$er an$ Stream

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    9/18

    &*e cass Binar,

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    10/18

    J

    Consoe.

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    11/18

    ubic cass &estM,%cetion

    J ubic static oi$ Main89

    J

    Strin sConsoe.)ea$/ine89K tr,

    J

    i8s./en*t*R159J M,%cetion mK

    m ne M,%cetion8QM, %cetion ccure$Q9K

    m.6no Qent* is reater t*an 15QK

    t*ro mKO

    ese

    Consoe.

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    12/18

    accor$in to *at rorammin anuae ,ou are usin. For e%ame i ,ou are or!in it*

    a ae name$ Same7ae t*e mar!u is in t*e ie Same7ae.as% an$ t*e co$e is in a ie

    Same7ae.as%.cs in C#.6n t*e co$e-be*in$ mo$e t*e e%ame use$ in t*e rece$in section or t*e sine-ie ae

    ou$ be in to arts. &*e mar!u ou$ be in one ie 8in t*is e%ame Same7ae.as%9

    an$ ou$ be simiar to t*e sine-ie ae as s*on in t*e ooin co$e e%ame.

    P)?e L)n?u)?e0C CodeFile0S)'(leP)?e&)#(.&5# In6e"it#0S)'(leP)?e

    AutoE!enti"eu(0t"ue

    Y*tmR

    Y*ea$ runatQsererQ R

    YtiteRCo$e-Be*in$ 7ae Mo$eYItiteR

    YI*ea$RYbo$,R

    Yorm i$Qorm1Q runatQsererQR

    Y$iR

    T6e *ollo

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    13/18

    or oerri$e an, settins $eine$ on t*e uer ee. Visua Stu$io enerates a $eaut

    eb.coni ie or eac* roject. An aication can e%ecute it*out a eb.coni ie

    *oeer ,ou cannot $ebu an aication it*out a eb.coni ie.

    ,i!3 Glo:)l&)#). *ile

    &*e Goba.asa% ie aso !non as t*e AS7.N& aication ie is an otiona ie t*at

    contains co$e or reson$in to aication-ee eents raise$ b, AS7.N& or b,(ttMo$ues.

    &*e Goba.asa% ie resi$es in t*e root $irector, o an AS7.N&-base$ aication. &*e

    Goba.asa% ie is arse$ an$ $,namica, comie$ b, AS7.N&.

    &*e Goba.asa% ie itse is coniure$ so t*at an, $irect )/ re?uest or it is

    automatica, rejecte$K e%terna users cannot $onoa$ or ie t*e co$e ritten it*in

    it.

    &*e Goba.asa% ie $oes not nee$ recomiation i no c*anes *ae been ma$e to it.

    &*ere can be on, one Goba.asa% ie er aication an$ it s*ou$ be ocate$ in t*e

    aication=s root $irector, on,.

    &*e Goba.asa% contains to t,es o eents t*ose are

    ents *ic* are ire$ or eer, re?uest ents *ic* are not ire$ or eer, re?uest

    /,:3 6)t )"e t6e ne< *e)tu"e# in G")(6i5)l De!i5e Inte"*)5e Plu# ,GDI3 > E.(l)in

    t6e' in det)il& Di**e"enti)te :eteice 6nterace 7us 8G>6+9

    1. Gra$ient Brus*es2. Car$ina Sines

    '. 6n$een$ent 7at* bjects

    4. &ransormations an$ t*e Matri% bject

    5. Scaabe )eions. A*a Ben$in

    D. Suort or Mutie 6mae Formats

    %& G")dient B"u#6e#9G>6+ e%an$s on eice 6nterace 8G>69 b,roi$in inear ra$ient an$ at* ra$ient brus*es or iin s*aes at*s an$ reions.

    Gra$ient brus*es can aso be use$ to $ra ines cures an$ at*s.

    1& C)"din)l #(line9 A car$ina sine is a se?uence o in$ii$ua cures joine$ to orm aarer cure. &*e sine is seciie$ b, an arra, o oints an$ asses t*rou* eac* oint in

    t*at arra,. A car$ina sine asses smoot*, 8no s*ar corners9 t*rou* eac* oint in t*e

    arra, an$ t*us is more reine$ t*an a at* create$ b, connectin strai*t ines. &*eooin iustration s*os to at*s one create$ b, connectin strai*t ines an$ one

    create$ as a car$ina sine.& Inde(endent P)t6 O:4e5t#9 6n G>6 a at* beons to a $eice conte%t an$ t*e at* is

    $estro,e$ as it is $ran. 6+ $rain is erorme$ b, a G")(6i5#object an$ ,oucan create an$ maintain seera G")(6i5#P)t6objects t*at are searate rom

    t*e G")(6i5#object. A G")(6i5#P)t6object is not $estro,e$ b, t*e $rain action so ,ou

    can use t*e same G")(6i5#P)t6object to $ra a at* seera times.

    /& T")n#*o"')tion# )nd t6e M)t"i. O:4e5t9G>6+ roi$es t*eM)t"i.object a oeru

    too t*at ma!es transormations 8rotations transations an$ so on9 eas, an$ e%ibe. A

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    14/18

    matri% object or!s in conjunction it* t*e objects t*at are transorme$. For e%ame

    aG")(6i5#P)t6object *as aG")(6i5#P)t699T")n#*o"'met*o$ t*at receies t*e a$$ress

    o aM)t"i.object as an arument. A sine '\' matri% can store one transormation or ase?uence o transormations. &*e ooin iustration s*os a at* beore an$ ater a

    se?uence o to transormations 8irst scae t*en rotate9.

    -& S5)l):le Re?ion#9G>6+ e%an$s reat, on G>6 it* its suort or reions. 6n G>6reions are store$ in $eice coor$inates an$ t*e on, transormation t*at can be aie$ to

    a reion is a transation. G>6+ stores reions in or$ coor$inates an$ aos a reion to

    un$ero an, transormation 8scain or e%ame9 t*at can be store$ in a transormationmatri%. &*e ooin iustration s*os a reion beore an$ ater a se?uence o t*ree

    transormations: scae rotate an$ transate.

    & Al(6) Blendin?9Note t*at in t*e reious iure ,ou can see t*e untransorme$ reion

    8ie$ it* re$9 t*rou* t*e transorme$ reion 8ie$ it* a *atc* brus*9. &*is is ma$eossibe b, a*a ben$in *ic* is suorte$ b, G>6+. 6+ roi$es t*e 6mae Bitma an$ Metaie casses *ic* ao ,ou to oa$ sae an$

    maniuate imaes in a ariet, o ormats. &*e ooin ormats are suorte$:

    BM7

    Gra*ics 6nterc*ane Format 8G6F9

    7G

    %i

    7NG

    &6FF

    6CN

    escrition >iscoer, an$ 6nteration9

    & / 8escrition /anuae9

    SOAP

    SA7 is an ;M/-base$ rotoco or e%c*anin inormation beteen comuters.

    SA7 is a communication rotoco

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    15/18

    SA7 is or communication beteen aications

    SA7 is a ormat or sen$in messaes

    SA7 is $esine$ to communicate ia 6nternet

    SA7 is atorm in$een$ent

    SA7 is anuae in$een$ent

    SA7 is sime an$ e%tensibe

    SA7 aos ,ou to et aroun$ ireas

    SA7 i be $eeoe$ as a

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    16/18

    sin assembies aos ,ou to semantica, rou unctiona units into a sine ie or

    uroses o $eo,ment ersionin an$ maintenance. Assembies *ae Met)d)t)store$ to roi$e ersion inormation aon it* a comete

    $escrition o met*o$s an$ t,es. 7art o t*is meta$ata is a M)ni*e#t. &*e maniest

    incu$es i$entiication inormation ubic t,es an$ a ist o ot*er use$ assembies.

    Di**e"en5e :et

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    17/18

    -,53 "ite ) ("o?")' to 5onne5t ) SL #e"!e" d)t):)#e

  • 8/10/2019 uptu mca512 university papaer solution year 2014_15

    18/18

    O

    O O

    O

    Ste( -9)un t*e aication.