Sem D Extra Question

download Sem D Extra Question

of 53

Transcript of Sem D Extra Question

  • 8/13/2019 Sem D Extra Question

    1/53

    QuestionNo: JMT1011

    Question Which of the following options enables you to obtain filterinitialization parameters?

    1 The FilterConfig reference

    ! The "er#let$e%uest reference

    & The "er#let$esponse reference

    ' The (ilter)hain reference

    )orrect *ns: 1

    QuestionNo: JMT101!

    Question The url+pattern element can be replace, with the --------- elementto create a filter that applies to a particular ser#let.

    1 filter+class

    ! ,ispatcher

    & filter+name

    4, servlet-name

    )orrect *ns: '

    QuestionNo: JMT101&

    Question Which of the following options ,oes N/T hol, true for */ pattern?

    1 n,er the */ pattern you can reuse the ,ata access co,e from otherser#lets.

    ! n,er the */ pattern you can ma2e changes to bac2+en, technologiesin,epen,ent of the front+en, technologies.

    3, Under the DAO pattern, the Web tier commnicates !ith the DAOclasses"

    ' n,er the */ pattern the business ser#ices ,o not nee, to 2now howthe ,ata is store,.

  • 8/13/2019 Sem D Extra Question

    2/53

  • 8/13/2019 Sem D Extra Question

    3/53

  • 8/13/2019 Sem D Extra Question

    4/53

    Question Wren has create, a ser#let that nee,s to be connecte, to a,atabase. Wren ,eci,es to establish a connection in a ser#let an, thenmaintain that connection as a member #ariable of that ser#let. Which of thefollowing ,rawbac2s is Wren li2ely to face?

    1 =erformance problem

    ., Threading problem

    & Maintenance problem

    ' "pee, problem

    )orrect *ns: !

    QuestionNo: JMT10'0

    Question Jac2 "mith is wor2ing as a Ja#a ,e#eloper in =. Tech 4t,. 6e is,e#eloping a web application using "er#lets an, J"=. 6e ,eci,es to use(ilters in the web application. 6e has to ensure that the filter woul, only beapplie, to internal ,ispatches to the $4 pattern D.,o an, not to any ,irectclient re%uests. 6e uses the following co,e to ,eclare the filter mapping:

    Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherF$HQH"TEG,ispatcherFEGfilter+mappingF

    6owe#er the abo#e co,e ma2e the au,it(ilter apply to the ,irect clientre%uests for a $4 which matches D.,o pattern. >,entify the error an, pro#i,ethe solution.

    1 $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherFre%uestEG,ispatcherFEGfilter+mappingF

    ! $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherFH$$/$EG,ispatcherFEGfilter+mappingF

  • 8/13/2019 Sem D Extra Question

    5/53

    & $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternF

    E,ispatcherFinclu,eEG,ispatcherFEGfilter+mappingF

    4, eplace the code !ith the follo!ing56filter-mapping76filter-name7aditFilter68filter-name76rl-pattern79"do68rl-pattern76dispatcher710CUD:68dispatcher76dispatcher7FOWAD68dispatcher768filter-mapping7

    )orrect *ns: '

    QuestionNo: JMT10'1

    Question Jac2 "mith is wor2ing as a Ja#a ,e#eloper in =. Tech 4t,. 6e is,e#eloping a web application using "er#lets an, J"=. 6e ,eci,es to use(ilters in the web application. 6e has to ensure that the filter woul, only beapplie, to ,irect client re%uests for a $4 which matches the D.,o patternan, not to internal ,ispatches. 6e uses the following co,e to ,eclare thefilter mapping:

    Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherF>N)4HEG,ispatcherFE,ispatcherF(/$W*$EG,ispatcherFEGfilter+mappingF

    6owe#er the abo#e co,e ma2e the au,it(ilter apply to the internal,ispatches for a $4 which matches D.,o pattern. >,entify the error an,pro#i,e the solution.

    1 $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherFH$$/$EG,ispatcherFEGfilter+mappingF

  • 8/13/2019 Sem D Extra Question

    6/53

    ! $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternF

    E,ispatcherF(/$W*$EG,ispatcherFEGfilter+mappingF

    & $eplace the co,e with the following:Efilter+mappingFEfilter+nameFau,it(ilterEGfilter+nameFEurl+patternFD.,oEGurl+patternFE,ispatcherF>N)4HEG,ispatcherFEGfilter+mappingF

    4, eplace the code !ith the follo!ing5

    6filter-mapping76filter-name7aditFilter68filter-name76rl-pattern79"do68rl-pattern76dispatcher7:;U:%T68dispatcher768filter-mapping7

    )orrect *ns: '

    QuestionNo: JMT10'!

    Question Jac2 "mith is wor2ing as a Ja#a ,e#eloper in =. Tech 4t,. 6e is,e#eloping a web application using "er#lets an, J"=. 6e ,eci,es to use(ilters in the web application. 6e uses the following co,e to ,eclare the filterin the application:

    EfilterFEfilter+nameFperf(ilterEGfilter+nameFEinit+paramFEparam+nameF4og Hntry =refiBEGparam+nameFEparam+#alueF=erformance: EGparam+#alueFEGinit+paramF

    EGfilterF

    6owe#er the abo#e co,e is incomplete in terms of filter ,eclaration. >,entifythe error?#, filter-class element is missing in the filter declaration"

    ! ser#let+name element is missing in the filter ,eclaration.

  • 8/13/2019 Sem D Extra Question

    7/53

    & ser#let+mapping element is missing in the filter ,eclaration.

    ' url+pattern element is missing in the filter ,eclaration.

    )orrect *ns: 1

    QuestionNo: JMT10''

    Question )onsi,er the co,e for filter mapping in the web application,eployment ,escriptor file:

    Eser#let+mappingFEser#let+nameFMy)ontrollerEGser#let+nameFEurl+patternFD.,oEGurl+patternFEGser#let+mappingF

    19Efilter+mappingFEfilter+nameF(irstEGfilter+nameFEser#let+nameFMy)ontrollerEGser#let+nameFEGfilter+mappingF

    !9Efilter+mappingFEfilter+nameF"econ,EGfilter+nameFEser#let+nameFMy)ontrollerEGser#let+nameFEGfilter+mappingF

    &9 Efilter+mappingF

    Efilter+nameFThir,EGfilter+nameFEurl+patternFD.,oEGurl+patternFEGfilter+mappingF

    '9Efilter+mappingFEfilter+nameF(ourthEGfilter+nameFEurl+patternFD.,oEGurl+patternFEGfilter+mappingF

    =re,ict the or,er in which filter will be applie, if the re%uest was ma,e for

    the $4 Ga,minGa,,-league.,o?

    1(irstF"econ,FThir,F(ourth

    .,Third7Forth7First7%econd

    &(ourthFThir,F"econ,F(irst

    '"econ,F(irstF(ourthFThir,

  • 8/13/2019 Sem D Extra Question

    8/53

    )orrect *ns: !

    QuestionNo: JMT10'

    &import org.apache.struts.*ction(ormpublic class employeeform eBten,s *ction(ormGGre%uire, co,e

    K

    'import org.apache.struts.action.*ction(ormpublic class employeeformGGre%uire, co,eK

  • 8/13/2019 Sem D Extra Question

    14/53

    )orrect *ns: !

    QuestionNo: JMT10'C

    Question 6arry wants to create a form bean in struts framewor2. 6e wants to

    perform certain #ali,ations for that form bean. Which class he shoul, use tocreate a form bean an, which metho, he shoul, use to perform the#ali,ations for the form bean?

    1*ction(orm )lass ,oIali,ate89 metho,

    !*ction )lass Iali,ate89 metho,

    3,ActionForm Class validate() method

    '*ction(orm )lass performIali,ations89 metho,

    )orrect *ns: &

    QuestionNo: JMT10'

    Question * Web application ,e#elope, for an e,ucational institution re%uiresinsertion of a hea,er file comprising the logo an, institution name. >,entifythe correct J"= tag from the options gi#en below to a,, the logo an,institution name to all the pages of the Web application.

    1Eform metho,7;post; action7;6ea,er.html;F

    .,6B inclde file&+$eader"html+ B7

    &E5sp:forwar, page7;6ea,er.html;F

    'EOP page import7;6ea,er.html; OF

    )orrect *ns: !

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    15/53

    9 The #ali,ate attribute in the action tag ,etermines whether #ali,ation willoccur for the form bean or not.

    Which of the following options is True with respect to the abo#e statements?

    1"tatement *3) are true an, is false.

    .,%tatement A is False and ,C,D are tre"

    &"tatement *3 are true an, ) are (alse.

    '"tatement *3 are true an, ) is (alse.

    )orrect *ns: !

    QuestionNo: JMT10A0

    Question Which of the following is N/T passe, as an argument to theeBecute metho, of the *ction class in the "truts framewor2?

    1 *ctionMapping

    ., $ttp%ervlet

    & *ction(orm

    ' 6ttp"er#let$e%uest

    )orrect *ns: !

    QuestionNo: JMT10&

    Question What ,oes the #ali,ate attribute in the action tag ,o?

    1Iali,ates the user name an, passwor,

    .,Determines !hether validation !ill occr for the form bean

    &*uthenticates the user to ,etermine the permissions in an application

    '=erforms the ,ata con#ersion in an application

    )orrect *ns: !

    QuestionNo: JMT10'

    Question What is return type of #ali,ate metho, in struts framewor2?

  • 8/13/2019 Sem D Extra Question

    16/53

    1*ctionHrror

    .,Action:rrors

    &*ction(orwar,

    '*ctionMapping

    )orrect *ns: !

    QuestionNo: JMT10C

    Question Which of the following is not the attribute ta2en by the *ction Tagin the struts configuration file?

    1name

    !scope

    ali,ate

    4,invalidate

    )orrect *ns: '

    QuestionNo: JMT1100

    Question Which of the following options is an eBample of a profit+base,organization?

    #, 1nsrance

    ! o#ernment+fun,e, uni#ersities

    & 6uman rights commissions

    ' Wor2er unions

    )orrect *ns: 1

    QuestionNo: JMT1101

    Question )onsi,er the following statements:

    "tatement *: The )ontinuous =rocess >mpro#ement of business processeshelps ensure that the eBisting processes stay efficient.

  • 8/13/2019 Sem D Extra Question

    17/53

    "tatement 3: )ontinuous =rocess >mpro#ement focuses on the criticalelements of a business process an, eliminates the elements that ,o not a,,any #alue.

    Which of the following options is correct in conteBt of the prece,ingstatements?

    1 "tatement * is true an, "tatement 3 is false.

    ! "tatement * is false an, "tatement 3 is true.

    & "tatement * an, "tatement 3 are false.

    4, %tatement A and %tatement are tre"

    )orrect *ns: '

    QuestionNo: JMT110!

    Question Lou are wor2ing as a sales hea, in >T"oft >nc. Lou ha#e to createpolicies an, strategies for the new financial year so as to enable theorganization to generate more re#enue an, earn more profit. (or this younee, to create an annual sales target report to 5ustify the policies an,strategies that you will create. Which of the following systems enables you toaccomplish the prece,ing tas2s?

    1 /nline Transaction =rocessing "ystem

    ! Management >nformation "ystem

    & Transaction =rocessing "ystem

    4, Decision %pport %stem

    )orrect *ns: '

    QuestionNo: JMT110&

    Question Lou are wor2ing as a senior manager in a retail organization. Lou

    want to impro#e the process of procuring of raw material manufacturing ofgoo,s an, selling of pro,uct to the en,+user so as to re,uce the tas2sin#ol#e, in maintaining the in#entory. Which of the following technologycomponents will you implement to accomplish the prece,ing tas2?

    1 Transaction =rocessing "ystem

    ., %ppl Chain @anagement

  • 8/13/2019 Sem D Extra Question

    18/53

    & Hnterprise $esource =lanning

    ' )ustomer $elationship Management

    )orrect *ns: !

    QuestionNo: JMT110'

    Question Which of the following 2ey attributes of a ser#ice helps you toensure more customers through the reference of ol, customers?

    1 >ntangible

    ! =erishable

    & Wor2force intensi#e

    4, elationship specific

    )orrect *ns: '

    QuestionNo: JMT110nc. 6e has accepte, the estimate, price an, terms an, con,itionsgi#en by TuneMe the items. Now he has to sen, a ,ocument that consists ofthe following components:

    1. *,,ress where the pro,ucts ha#e to be ,eli#ere,.

    !. Number of items that is to be purchase,.

    &. Types of Music Is an, )s an, boo2s.

    Which of the following ,ocuments will William use to specify the abo#ecomponents an, sen, to TuneMe >nc?

    1 Quotation

    ! >n#oice

    3,

  • 8/13/2019 Sem D Extra Question

    20/53

    QuestionNo: JMT110

    Question Lou are wor2ing as a mar2eting eBecuti#e in MunchMore >nc. Lounee, to prepare campaign ,ata for the pro,uct that is to be launche, in theneBt %uarter. Which of the following se%uences of steps will you perform tocreate the campaign ,ata?

    #, #" et lead database information"." enerate campaign"3" %tore campaign details in the database"4" nc. "he has to

    prepare a =rofit an, 4oss *ccount to get the information to control theorganization eBpenses. 6ow will Jones prepare a =rofit an, 4oss *ccount incase of the loss shown by the result of tra,ing account?

    1 3y performing the following steps:

    1.Write all the entries relate, to in,irect eBpenses on the ,ebit si,e an, allthe entries relate, to the incomes an, gains on the cre,it si,e.

  • 8/13/2019 Sem D Extra Question

    21/53

    !.Write the amount of gross loss on the ,ebit si,e of the profit an, lossaccount un,er the entry RTo ross 4oss bG,S.&.)alculate total for both the ,ebit si,e an, cre,it si,e an, compare them.'.Write the total at the en, of the *mount columns on both the si,es.

  • 8/13/2019 Sem D Extra Question

    22/53

    QuestionNo: JMT1111

    Question Lou are wor2ing as an accountant in Ien,"oft >nc. Lou nee, tocreate a le,ger account using Tally. Which of the following se%uences ofsteps will you perform to accomplish the prece,ing tas2?

    1 1. "elect *ccounts>nfo++F4e,gers++F)reate.!. =ress Hnter to go to the n,er fiel, an, select the group of the accountsun,ry cre,itors from the list ,isplaye, on the right si,e of the Tally pane.&. Hnter the name of the le,ger in the Name teBtboB.'. "elect options to sa#e the ,etails of the le,ger.

    ! 1. "elect *ccounts>nfo++F4e,gers++F)reate.!. Hnter the name of the le,ger in the Name teBtboB.&. "elect options to sa#e the ,etails of the le,ger.'. =ress Hnter to go to the n,er fiel, an, select the group of the accountsun,ry cre,itors from the list ,isplaye, on the right si,e of the Tally pane.

    3, #" %elect Acconts1nfo--7edgers--7Create"." :nter the name of the ledger in the 0ame te?tbo?"3" nfo++F4e,gers++F)reate.!. =ress Hnter to go to the n,er fiel, an, select the group of the accountsun,ry cre,itors from the list ,isplaye, on the right si,e of the Tally pane.&. "elect options to sa#e the ,etails of the le,ger.'. Hnter the name of the le,ger in the Name teBtboB.

    )orrect *ns: &

    QuestionNo: JMT100

    Question The web container maintains a pool of instances that is largeenough to han,le a number of simultaneous --------------------.

    1)lients

    !$esponses

  • 8/13/2019 Sem D Extra Question

    23/53

    3,e'ests

    '"er#ers

    )orrect *ns: &

    QuestionNo: JMT10!

    Question ----------------- creates a new re%uest an, response ob5ect foreach new re%uest that it han,les.

    1HJ3 )ontainer

    !"er#let

    3,Web Container

    'J"= =age

    )orrect *ns: &

    QuestionNo: JMT10&

    Question Which of the following programs runs in a separate threa, in theWeb container for each client re%uest?

    1 6TM4

    ., %ervlets

    & )>

    ' =earl

    )orrect *ns: !

    QuestionNo: JMT10'

    Question Lou are creating a Web application. (or this you ha#e to ,efine#arious 5ob roles in your Web application team. /ne of the 5ob roles re%uires

    creating Iiew elements such as 6TM4 pages or ,ynamically generate,pages. >,entify the 5ob role.

    1 Web )omponent e#eloper

    ., Web Designer

    & 3usiness )omponent e#eloper

  • 8/13/2019 Sem D Extra Question

    24/53

    ' ata *ccess e#eloper

    )orrect *ns: !

    QuestionNo: JMT10,entify the5ob role.

    #, Web Component Developer

    ! Web esigner

    & 3usiness )omponent e#eloper

    ' ata *ccess e#eloper

    )orrect *ns: 1

    QuestionNo: JMT10

    Question Which metho, can be use, to submit form ,ata that shoul, not beeBpose, for #iewing?

    1 =T

    !HT

    3,

  • 8/13/2019 Sem D Extra Question

    25/53

    3, siness Component Developer

    ' ata *ccess e#eloper

    )orrect *ns: &

    QuestionNo: JMT10

    Question 6ttp"er#let$e%uest is a sub interface of ------------.

    16ttp$e%uest

    .,%ervlete'est

    &6ttp"er#let

    '>t is not a sub+interface

    )orrect *ns: !

    QuestionNo: JMT10A1

    Question Whene#er a re%uest goes from the client to the ser#er somea,,itional information other than the re%uest is also passe, to the ser#er.This a,,itional information is in the form of a ------------.

    1footer

    .,header

    &*pplication >

    '"ession >

    )orrect *ns: !

    QuestionNo: JMT10A&

    Question Which metho, of the 6ttp"er#let class is implemente, to filter

    incoming re%uests by type?

    #,service

    !,oet

    &,o=ost

    ',o=ut

  • 8/13/2019 Sem D Extra Question

    26/53

    )orrect *ns: 1

    QuestionNo: JMT10A'

    Question Which of the following action is not performe, by ser#lets?

    1$etrie#e form ,ata

    !$etrie#e security information

    &enerate output

    4,Chec2 compilation errors

    )orrect *ns: '

    QuestionNo: JMT10An,epen,ent.

    !"er#lets are robust an, ob5ect oriente,.

    3,%ervlets onl contains bsiness logic"

    'Hach re%uest in ser#let runs in separate threa,.

    )orrect *ns: &

  • 8/13/2019 Sem D Extra Question

    28/53

    QuestionNo: JMT111!

    Question )lara is ,e#eloping the home page of a website using ser#lets. "hewants the image in the Welcome.5pg file to be ,isplaye, on the home page.Which of the following metho,s shoul, )lara use to generate the response?

    #, getOtpt%tream()

    ! getWriter89

    & set6ea,er89

    ' get6ea,er89

    )orrect *ns: 1

    QuestionNo: JMT111&

    Question =re,ict the output of the following co,e:

    import 5a#a.io.Dimport 5a#a.net.Dimport 5a#aB.ser#let.Dimport 5a#aB.ser#let.http.Dpublic class earnmore eBten,s 6ttp"er#letpublic #oi, ,oet86ttp"er#let$e%uest re%uest 6ttp"er#let$esponseresponse9 throws >/HBception"tring pageTitle 7 ;Welcome to HarnMore 3an2;response.set)ontentType8;teBtGhtml;9out.println8;EhtmlF;9out.println8;Ebo,yF;9out.println8pageTitle9out.println8;EGbo,yF;9out.println8;EGhtmlF;9KK1 The co,e will compile an, eBecute successfully. The string Welcome toHarnMore 3an2 will be ,isplaye,.! The co,e will compile successfully but gi#e a runtime error.

    & The co,e will ,isplay a blan2 page.

    4, The code !ill give compilation error"

    )orrect *ns: '

    QuestionNo: JMT111'

  • 8/13/2019 Sem D Extra Question

    29/53

    Question Jennifer has create, an 6TM4 form that accepts two numbers fromthe user. This form contains a button. When this button is clic2e, thenumbers are passe, to a ser#let. Jennifer creates a ser#let name, )alculateto calculate the sum of the numbers entere, by the user. "he then createsanother ser#let name, isplay to ,isplay this sum. Now she wants the sum

    calculate, by the )alculate ser#let to be passe, to the isplay ser#let. Theco,e of the )alculate ser#let is:

    import 5a#aB.ser#let.D

    import 5a#aB.ser#let.http.D

    import 5a#a.io.D

    public class )alculate eBten,s 6ttp"er#let

    public #oi, ,oet86ttp"er#let$e%uest re%uest 6ttp"er#let$esponseresponse9 throws "er#letHBception >/HBception

    int num17>nteger.parse>nt8re%uest.get=arameter8;number1;99

    int num!7>nteger.parse>nt8re%uest.get=arameter8;number!;99

    int result7 num1num! K

    K

    Which of the following co,e snippets will help Jennifer use to pro#i,e there%uire, functionality?

    1 re%uest.set*ttribute8;result;new >nteger8result99$e%uestispatcher re%isp7re%uest.get$e%uestispatcher8;Gisplay;9re%isp.forwar,8re%uestresponse9

    ! $e%uestispatcher re%isp7re%uest.get$e%uestispatcher8;Gisplay;9re%isp.forwar,8re%uestresponse9

    3, re'est"setAttribte(+reslt+,ne! 1nteger(reslt))*

    e'estDispatcherre'Disp&re'est"gete'estDispatcher(+Displa+)*re'Disp"for!ard(re'est,response)*

    ' response.set*ttribute8;result;new >nteger8result99$e%uestispatcher re%isp7re%uest.get$e%uestispatcher8;isplay;9re%isp.forwar,8re%uestresponse9

  • 8/13/2019 Sem D Extra Question

    30/53

    )orrect *ns: &

    QuestionNo: JMT111/HBception

    import 5a#a.io.=rintWriter

    import 5a#aB.ser#let."er#let)onfig

    import 5a#aB.ser#let."er#letHBceptionimport 5a#aB.ser#let.http.6ttp"er#let

    import 5a#aB.ser#let.http.6ttp"er#let$e%uest

    import 5a#aB.ser#let.http.6ttp"er#let$esponse

    public class hello eBten,s 6ttp"er#let

    protecte, #oi, ,oet86ttp"er#let$e%uest re%uest 6ttp"er#let$esponse

    response9 throws "er#letHBception >/HBception

    =rintWriter out 7 response.getWriter89

    out.println8;EhtmlF;9

    out.println8;Ehea,F;9

    out.println8;EtitleFMy "er#letEGtitleF;9

    out.println8;EGhea,F;9

    out.println8;Ebo,yF;9

    out.println8;Eh1FWH4)/MHEGh1F;9

    out.println8;EGbo,yF;9

    out.println8;EGhtmlF;9

  • 8/13/2019 Sem D Extra Question

    31/53

    out.close89

    K

    K

    Which of the following co,e snippets correctly ,efines the ,eployment,escriptor for the prece,ing ser#let?

    1 Eser#letFEser#let+nameFhelloEGser#let+nameFEser#let+classFhelloEGser#let+classFEGser#letFEser#let+mappingFEser#let+nameFhelloEGser#let+nameFEurl+patternFGhelloEGurl+patternFEGser#let+mappingF

    ., 6servlet76servlet-name7hello68servlet-name76servlet-class7m!orld"hello68servlet-class768servlet76servlet-mapping76servlet-name7hello68servlet-name76rl-pattern78hello68rl-pattern768servlet-mapping7

    & Eser#letF

    Eser#let+nameFmyworl,.helloEGser#let+nameFEser#let+classFhelloEGser#let+classFEGser#letFEser#let+mappingFEser#let+nameFhelloEGser#let+nameFEurl+patternFGhelloEGurl+patternFEGser#let+mappingF

    ' Eser#letFEser#let+nameFhelloEGser#let+nameFEser#let+classFmyworl,.helloEGser#let+classF

    EGser#letFEser#let+mappingFEser#let+nameFhelloEGser#let+nameFEurl+patternFhelloEGurl+patternFEGser#let+mappingF

  • 8/13/2019 Sem D Extra Question

    32/53

    )orrect *ns: !

    QuestionNo: JMT1001

    Question =aul has create, a bean calle, myclass that wraps a collection of

    stu,ent ob5ects. 6e has written the following co,e snippet to iterate o#er themyclass bean an, pro,uce one row for each stu,ent:

    Ec:forHach #ar7;stu,ent; items7;Umyclass.myclassK;FEtrFEt,FUstu,ent.nameKEGt,FEt,FUstu,ent.ageKEGt,FEt,FUstu,ent.heightKEGt,FEGtrFEGc:forHachFNow =aul wants to write the prece,ing co,e snippet using scriptlets an,

    unor,ere, list. Which of the following co,e snippets fulfills =aul@sre%uirement?#, 6l76B1terator items & mclass"iterator()*!hile ( items"has0e?t() ) =mclass mclass# & (mclass) items"ne?t()*B76li76B& stdent"getTitle() B768li76B > B768l7

    ! EulFEO>terator items 7 myclass.iterator89while 8 items.hasNeBt89 9 myclass myclass1 7 items.neBt89OFEliFEO7 stu,ent.getTitle89 OFEGliFEO K OFEGulF

    & EulFEO>terator items 7 myclass.iterator89myclass myclass1 7 8myclass9 items.neBt89OFEliFEO7 stu,ent.getTitle89 OFEGliFEO K OFEGulF

    http://student.name/http://student.name/
  • 8/13/2019 Sem D Extra Question

    33/53

    ' EulFEO>terator items 7 myclass.iterator89while 8 items.hasNeBt89 9

    myclass myclass1 7 8myclass9 items.neBt89OFEliFEO7 myclass.getTitle89 OFEGliFEO K OFEGulF

    )orrect *ns: 1

    QuestionNo: JMT100!

    Question 4in,a has create, a ser#let that accepts the name phone number

    a,,ress an, e,ucational %ualifications of the user. The ser#let contains teBtfiel,s to enter the name phone number an, a,,ress. >t contains a ,rop+,own list from which the user can select the %ualifications. 4in,a wants the,rop+,own list to be populate, with the #alues 10! gra,uation an, postgra,uation after the ser#let instance is create,. >n which of the followingmetho,s shoul, 4in,a place the co,e to populate the ,rop+,own list?

    1 get"er#let)onfig89

    ! get=arameter89

    & ser#ice89

    ' init89

    )orrect *ns: '

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    34/53

  • 8/13/2019 Sem D Extra Question

    35/53

    Question )onsi,er the following co,e:

    EOP page language7;5a#a;OF

    EhtmlF

    Ebo,yF

    EO "tring login78re%uest.get=arameter8;4ogin;99

    "tring passwor,78re%uest.get=arameter8;=asswor,;99

    for8int i70iE10i9

    out.println8;4ogin is;; ;login9

    out.println8;=asswor, is;; ;passwor,9

    OF

    EGbo,yF

    EGhtmlF

    What will be the output of the abo#e co,e if login name an, passwor, areaccepte, through user interface?

    14ogin message will be ,isplaye, ten times an, =asswor, message once.

    !3oth login an, passwor, message will be ,isplaye, ten times.

    &4ogin Message will be ,isplaye, nine times an, =asswor, message once.'3oth login an, passwor, message will be ,isplaye, nine times.

    )orrect *ns: 1

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    36/53

    6owe#er the prece,ing co,e snippet contains some errors. =re,ict thecorrect co,e.

    1Efont color7@green@FEulFEc:forHach #ar7errmsg items7;UerrorMsgsK;FEliFUerrmsgEGliFEGc:forHachFEGulFEGfontF

    !Efont color7@green@FEulFEc:forHach #ar7;errmsg; items7;UerrorMsgsK;FEliFUerrmsgKEGliF

    EGc:forHachFEGulFEGfontF

    &Efont color7@green@FEulFEc:forHach #ar7;errmsg; items7;UerrorMsgsK;FEliFUerrmsgEGliFEGc:forHachFEGulFEGfontF

    'Efont color7@green@FEulFEc:forHach #ar7errmsg items7;UerrorMsgsK;FEliFUerrmsgKEGliFEGc:forHachFEGulFEGfontF

    )orrect *ns: !

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    37/53

    )9 The $esult of the HBpression tag is inclu,e, in 6TT= re%uest stream.

    9*fter H#aluation the #alue of HBpression tag has to be con#erte, to a"tring.

    Which of the following options is True with respect to the abo#e statements?

    1"tatement *3 an, ) are true.

    !"tatement * an, are true.

    &"tatement 3) an, are true.

    '"tatement *3 an, are true.

    )orrect *ns: !

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    38/53

    EOV

    login.setIalue8re%uest.get=arameter8;4ogini,;99

    login.set*,,ress8re%uest.get=arameter8;a,,ress;99

    OF

    E5sp:use3eanF

    &E5sp:use3ean i,7;login; scope7;"ession;class7;s1&1'.beans.4ogin3ean;F

    login.setIalue8re%uest.get=arameter8;4ogini,;99

    login.set*,,ress8re%uest.get=arameter8;a,,ress;99

    EG5sp:use3eanF

    'E5sp:use3ean i,7;login; scope7;"ession;class7;s1&1'.beans.4ogin3ean;F

    Elogin.setIalue8re%uest.get=arameter8;4ogini,;99GF

    Elogin.set*,,ress8re%uest.get=arameter8;a,,ress;99GF

    EG5sp:use3eanF

    )orrect *ns: 1

    QuestionNo: JMT10

  • 8/13/2019 Sem D Extra Question

    39/53

    EG5sp+configF

    !E5sp+property+groupF

    Eurl+patternFGscriptting-offGDEGurl+patternF

    Escripting+in#ali,FtrueEGscripting+in#ali,F

    EG5sp+property+groupF

    E5sp+property+groupF

    Eurl+patternFGH4-offGDEGurl+patternF

    Eel-ignore,FtrueEGel-ignore,F

    EG5sp+property+groupF

    &E5sp+configF

    Eurl+patternFGscriptting-offGDEGurl+patternF

    Escripting+in#ali,FtrueEGscripting+in#ali,F

    Eurl+patternFGH4-offGDEGurl+patternF

    Eel-ignore,FtrueEGel-ignore,F

    EG5sp+configF

    'E5sp+configF

    E5sp+property+groupF

    Eurl+patternFscriptting-offEGurl+patternF

    Escripting+in#ali,FtrueEGscripting+in#ali,F

    EG5sp+property+groupF

    E5sp+property+groupF

    Eurl+patternFH4-offEGurl+patternF

    Eel-ignore,FtrueEGel-ignore,FEG5sp+property+groupF

    EG5sp+configF F

    )orrect *ns: 1

    QuestionNo: JMT101

  • 8/13/2019 Sem D Extra Question

    40/53

    Question Which metho, ,oes the ser#let *=> use to get the ser#let@sinitialization parameters?

    1init=arameter

    !get>nit

    &get>nit=arameter

    'get=arameter

    )orrect *ns: &

    QuestionNo: JMT10C

    Question Which of the following metho,s of the eneric"er#let abstract classta2es re%uest an, response ob5ects as arguments?

    1 init

    ! ser#ice

    & ,estroy

    ' get"er#let)onteBt

    )orrect *ns: !

    QuestionNo: JMT10A!

    Question /nce the usage of the web component is o#er the web containerremo#es the web component. Which metho, is calle, by the web containerbefore it remo#es the instance of the web component?

    1,elete

    !remo#e

    &ser#ice

    ',estroy

    )orrect *ns: '

    QuestionNo: JMT10A

    Question Which of the following is the correct se%uence of life cycle of aser#let?

    1init89

  • 8/13/2019 Sem D Extra Question

    41/53

    ser#ice89

    ,estroy89

    !init89

    start89

    ,estroy89

    &ser#ice89

    init89

    ,estroy89

    'start89

    ser#ice89

    ,estroy89

    )orrect *ns: 1

    QuestionNo: JMT10C!

    Question Which function of "er#let)onfig interface is use, to retrie#e ser#letinitialization parameters?

    1get>nit=arameter89

    !get>nit=arameters89&get>nitial=arameters89

    'get=arameters89

    )orrect *ns: 1

    QuestionNo: JMT10C

    Question What is the syntaB of HBpression 4anguage in a J"= page?

    1UeBprK

    !eBprK

    &U;eBpr;K

    'UXeBprY

    )orrect *ns: 1

  • 8/13/2019 Sem D Extra Question

    42/53

    QuestionNo: JMT10CA

    Question Which attribute of page ,irecti#e is use, for specifying the name ofanother 5sp page that will han,le all run time eBceptions?

    1err

    !error=age

    &error-page

    'runtimeerrorpage

    )orrect *ns: !

    QuestionNo: JMT10CC

    Question Which attribute of page ,irecti#e is use, for specifying thesuperclass of ser#let class that is generate, from the 5sp page?

    15sp:eBten,s

    !implements

    &eBten,s

    '5speBten,s

    )orrect *ns: &

    QuestionNo: JMT100

    Question Which metho, of 5sp is e%ui#alent to ser#ice metho, of ser#let?

    1-5sp"er#ice89

    !5sp-"er#ice89

    &5sp"er#ice89

    'ser#ice89

    )orrect *ns: 1

    QuestionNo: JMT10nterface he shoul, use to perform somecleanup acti#ities for web application?

    1,estroy89

    !conteBtestroy89

    &close89

    'conteBtestroye,89

    )orrect *ns: '

    QuestionNo: JMT10

    Question 4ist ,own the metho,s of "er#let)onteBt >nterface.

    1get>nit=arameter8name:"tring9:"tringget>nit=arameterNames89:Hnumerationget$esource8path9:$4get$esource*s"tream8path9:>nput"tream

    !get>nit=arameter8name:"tring9:"tringget>nit=arameter4ist89:Hnumerationget$esourcerl8path9:$4get$esource*s"tream8path9:>nput"tream

    &get>nit=arameter89:"tringget>nit=arameter#alues89:Hnumerationget$esource8path9:$4get$esource*s"tream8path9:#oi,

    'get>nit=arameter8name:"tring9:"tringget>nit=arameter4ist89:Hnumerationget$esource*s>nput"tream8path9:>nput"tream

  • 8/13/2019 Sem D Extra Question

    44/53

    )orrect *ns: 1

    QuestionNo: JMT111

    Question Margaret is ,e#eloping a Web application for a tra#el agency. "hecreates a ser#let with the initialization parameter holi,ay-,estination. 3ase,on the #alues of the initialization parameter the ser#let ,isplays the rele#antinformation. Margaret now wants to retrie#e the #alue of the initializationparameter. Which of the following co,e snippets helps retrie#e theinitialization parameter successfully?

    1 public #oi, ,oet86ttp"er#let$e%uest re% 6ttp"er#let$esponse res9throws "er#letHBception >/HBception"tring strIalue7get>nit=arameter8;holi,ay-,estination;9K

    ! public #oi, init89 throws "er#letHBception"tring strIalue7get>nit=arameter8;holi,ay-,estination;9K

    & public #oi, ,o=ost86ttp"er#let$e%uest re% 6ttp"er#let$esponse res9throws "er#letHBception >/HBception"tring strIalue7get>nit=arameter8;holi,ay-,estination;9K

    ' public #oi, init89 throws "er#letHBception"tring strIalue7re%uest.get>nit=arameter8;holi,ay-,estination;9K

    )orrect *ns: !

    QuestionNo: JMT111A

    Question "amantha is ,e#eloping an online boo2 store. "he creates aJa#a3ean that accepts an, stores the boo2 preferences of a user in the arrayuserpref. Now "amantha wants to ,e#elop a ser#let that retrie#es the boo2preferences from the Ja#a3ean. Which of the following co,e snippets willhelp her retrie#e the thir, element of the userpref array?

    1 Uparam.userprefX!YK

    ! UparamIalues.userprefX&YK

  • 8/13/2019 Sem D Extra Question

    45/53

    & paramIalues.userprefX!YK

    ' UparamIalues.userprefX!YK

    )orrect *ns: '

    QuestionNo: JMT100&

    Question eorge is ,e#eloping an application for an airline ser#ice. uringthe ,e#elopment of the application he is face, with the problem of couplingbetween #iew an, controller components. >n a,,ition he fin,s that a lot ofcommon infrastructure processing is being use, in the controllers of theapplication. 6e wants to a#oi, scripting the same co,e repeate,ly. Which ofthe following patterns will help eorge resol#e these problems?

    1 Ialue /b5ect pattern

    ! MI) pattern

    & */ pattern

    ' (ront )ontroller pattern

    )orrect *ns: '

    QuestionNo: JMT100'

    Question Mar2 is ,e#eloping an application using the "truts MI) framewor2.6e wants to configure the mappings between $4 patterns an, the controller

    classes. Which of the following options will help Mar2 in this tas2?

    1 3ase classes

    ! The strutsconfig.Bml file

    & The *ction"er#let class

    ' The *ction class

    )orrect *ns: &

    QuestionNo: JMT100n this Web application the team membersha#e create, three ser#ices "tu,ent"er#ice 3atch"er#ice an,3atch*llocation"er#ice. The 3atch*llocation"er#ice interacts with the"tu,ent"er#ice an, 3atch"er#ice to allocate a batch to a stu,ent. 6owe#erthe team members fin, that there is a tight coupling between the threeser#ices in the application. To re,uce coupling "am ,eci,es to use the"truts framewor2 in the application. *nalyze the scenario an, pre,ictwhether "am will be able to re,uce coupling. >f not pro#i,e the solution.

    1 No "am shoul, use the (a[a,e "er#ice in the application.

    ! Les "am will be able to re,uce coupling by using the "truts framewor2 in

    the application.

    & No "am shoul, use HJ3 in the application.

    ' No "am shoul, use entity ser#ice in the application.

    )orrect *ns: 1

    QuestionNo: JMT100C

  • 8/13/2019 Sem D Extra Question

    47/53

    Question Mar2 is ,e#eloping a shopping site for Nucleus >nc. using the "trutsframewor2. 6e has to write the co,e to trac2 the items that a user a,,s tothe shopping cart. To implement this functionality he writes the followingco,e in the *,,>tems*ction class:

    public class *,,>tems*ction eBten,s *ction

    public *ction(orwar, eBecute8*ction(orm form 6ttp"er#let$e%uest re%uest6ttp"er#let$esponse response9

    4ist errorMsgs 7 new 4in2e,4ist89

    re%uest.set*ttribute8;errorMsgs; errorMsgs9

    try

    "tring item"tr 7 re%uest.get=arameter8;>tem;9.trim89

    "tring item)o,e 7 re%uest.get=arameter8;)o,e;9.trim89

    ..........

    ..........

    K

    catch8HBception H9

    H.print"tac2Trace89

    K

    K

    K

    6owe#er the prece,ing co,e causes errors ,uring compilation. *nalyze theprece,ing co,e to i,entify the cause of error an, pro#i,e the solution.

    1 The set*ttribute89 metho, is use, incorrectly in the co,e. The correct co,eis:

    response.set*ttribute8;errorMsgs; errorMsgs9

  • 8/13/2019 Sem D Extra Question

    48/53

    ! The set*ttribute89 metho, is use, incorrectly in the co,e. The correct co,eis:

    re%uest.set*ttribute8errorMsgs ;errorMsgs;9

    & The incorrect signature of the eBecute89 metho, is use, in the co,e. The

    correct signature is:

    public *ction(orwar, eBecute8*ctionMapping mapping *ction(orm form6ttp"er#let$esponse response9

    ' The incorrect signature of the eBecute89 metho, is use, in the co,e. Thecorrect signature is:

    public *ction(orwar, eBecute8*ctionMapping mapping *ction(orm form6ttp"er#let$e%uest re%uest 6ttp"er#let$esponse response9

    )orrect *ns: '

    QuestionNo: JMT100

    Question Jenny has been assigne, the tas2 to ,e#elop a login mo,ule of aWeb application that authenticates the users an, pro#i,es success an,failure messages ,epen,ing upon the user cre,entials. The two types ofusers of the Web application are pro#i,er an, consumer. *s the Webapplication has been ,e#elope, using the "truts framewor2 Jenny createstwo action classes to #ali,ate the users. The Iali,ate=ro#i,e*ction class#ali,ates the users who log in as pro#i,er. 6owe#er the

    Iali,ate)onsumer*ction class the users who log in as consumer. "he storesthe two action classes in the #ali,ate pac2age of the application. *ftercreating the action classes she writes the following co,e in the struts+config.Bml file to configure the action classes:

    Eaction+mappingsF

    Eaction path7;G"truts*ppGform; type7;GIali,ate=ro#i,e*ction;F

    Eforwar, name7;success; path7;GwebpageGsuccess.#iew;GF

    Eforwar, name7;error; path7;GwebpageGerror.#iew;GF

    EGactionF

    Eaction path7;G"truts*ppGform; type7;GIali,ate)onsumer*ction;F

    Eforwar, name7;success; path7;GwebpageGsuccess.#iew;GF

    Eforwar, name7;error; path7;GwebpageGerror.#iew;GF

    EGactionF

  • 8/13/2019 Sem D Extra Question

    49/53

    EGaction+mappingsF

    6owe#er Jenny is not able to perform the ,esire, tas2 with the prece,ingmapping. >,entify the correct co,e that Jenny can use to perform the ,esire,tas2.

    1 Eaction+mappingsFEaction path7;G"tuts*ppGform; type7;#ali,ate.Iali,ate=ro#i,e*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEaction path7;G"truts*ppGform; type7; #ali,ate.Iali,ate)onsumer*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEGaction+mappingsF

    ! Eaction+mappingsFEaction path7;G"tuts*ppGform; type7;#ali,ateGIali,ate=ro#i,e*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEaction path7;G"truts*ppGform; type7; #ali,ateGIali,ate)onsumer*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEGaction+mappingsF

    & Eaction+mappingsFEaction path7;G"tuts*ppGform; type7;G#ali,ateGIali,ate=ro#i,e*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEaction path7;G"truts*ppGform; type7; G#ali,ateGIali,ate)onsumer*ction;FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEGaction+mappingsF' Eaction+mappingsFEaction path7;G"tuts*ppGform; type7#ali,ate.Iali,ate=ro#i,e*ctionFEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionF

  • 8/13/2019 Sem D Extra Question

    50/53

    Eaction path7;G"truts*ppGform; type7 #ali,ate.Iali,ate)onsumer*ction FEforwar, name7;success; path7;GwebpageGsuccess.#iew;GFEforwar, name7;error; path7;GwebpageGerror.#iew;GFEGactionFEGaction+mappingsF

    )orrect *ns: 1

    QuestionNo: JMT1010

    Question $obin is ,e#eloping a Web application by using the "trutsframewor2. 6e stores the application in a fol,er name, "truts*pp. Moreo#erhe creates the lib fol,er in the "truts*pp fol,er an, stores the struts.5arcommons+beanutils.5ar an, commons+,igester.5ar files in the lib fol,er.6owe#er he is not able to eBecute the application successfully. >,entify theproblem an, pro#i,e the solution.

    1 $obin shoul, mo#e the lib fol,er to the src fol,er of the application.

    ! $obin shoul, mo#e the lib fol,er to the web fol,er of the application.

    & $obin shoul, mo#e the lib fol,er to the WH3+>N( fol,er of the application.

    ' $obin shoul, mo#e the lib fol,er to the classes fol,er of the application.

    )orrect *ns: &

    QuestionNo: JMT10&

    Question Lou ha#e been assigne, the tas2 of ,esigning the web applicationfor the 4ibrary of your organization. The web application is ,i#i,e, into threecomponents: 3oun,ary "er#ice an, Hntity. Lou are re%uire, to re,uce thecoupling between the boun,ary components an, other ser#ices while,esigning the communication between them in the web application. 6ow willyou perform this tas2?

    1 3y using the Hntity relate, ser#ices.

    ! 3y using the (aca,e ser#ice.

    & 3y using omain Hntities.' 3y using the *nalysis mo,el.

    )orrect *ns: !

    QuestionNo: JMT10&A

  • 8/13/2019 Sem D Extra Question

    51/53

    Question Lou are ,e#eloping a web application for the soccer league using"truts framewor2. (or this you nee, to create a "truts controller thateBten,s the "truts *ction base class an, implements the eBecute metho,.6ow will you ,eclare the eBecute metho, in the "truts controller class?

    1 public *ction(orwar, eBecute8*ctionMapping mapping *ction(orm form6ttp"er#let$e%uest re%uest 6ttp"er#let$esponse response9

    GGwrite the co,e

    K

    ! public #oi, eBecute8*ctionMapping mapping *ction(orm form6ttp"er#let$e%uest re%uest 6ttp"er#let$esponse response9

    GGwrite the co,e

    K

    & public int eBecute8*ctionMapping mapping 6ttp"er#let$e%uest re%uest6ttp"er#let$esponse response9

    GGwrite the co,e

    K

    ' public *ction(orwar, eBecute8*ction(orm form 6ttp"er#let$e%uestre%uest 6ttp"er#let$esponse response9

    GGwrite the co,e

    K

    )orrect *ns: 1

    QuestionNo: JMT10&C

    Question Lou are ,e#eloping a web application for the soccer league usingser#lets. Lou ,eci,e, to use the "truts framewor2 to ,e#elop the webapplication. (or this you nee, to create a "truts controller. 6ow will youcreate the "truts controller class?

    1 3y eBten,ing the "truts *ction class

  • 8/13/2019 Sem D Extra Question

    52/53

    ! 3y eBten,ing the "truts *ction(orwar, class

    & 3y eBten,ing the "truts *ctionMapping class

    ' 3y eBten,ing the "truts *ction(orm class

    )orrect *ns: 1

    QuestionNo: JMT10&

    Question Lou are ,e#eloping a web application using "er#lets. Lou ,eci,e touse "truts framewor2 to ,e#elop the web application. (or this you arere%uire, to first configure the "truts >nfrastructure )ontroller. What will you,o to configure the "truts >nfrastructure )ontroller?

    1 )onfigure the action mappings.

    ! >nstall the "truts library files.

    & )onfigure the "truts *ction"er#let in the ,eployment ,escriptor file.

    ' )onfigure application+specific classes.

    )orrect *ns: &

    QuestionNo: JMT10C0

    Question Which component is use, for implementing communicationbetween the entity an, boun,ary component?

    1ser#ice

    !#iew

    &controller

    'eBternal entity

    )orrect *ns: 1

    QuestionNo: JMT10C1

    Question Which pac2age is use, for implementing struts framewor2 in aprogram?

    1org.apache.strutsframewor2.action

    !org.apache.struts.action

    &org.apache

  • 8/13/2019 Sem D Extra Question

    53/53

    'org.apach-struts

    )orrect *ns: !

    QuestionNo: JMT10C

    Question The return type of the eBecute metho, in struts framewor2 is-----------.

    1 *ction(orm

    !*ction(orwar,

    &*ctionMapping

    '*ction

    )orrect *ns: !QuestionNo: JMT10!

    Question What is the primary "truts (ramewor2 4ibrary file?

    1struts.5ar

    !struts-lib.5ar

    &strutslib.5ar

    'struts-primary.5ar

    )orrect *ns: 1