000287V343.docx
- 文档编号:16985265
- 上传时间:2023-07-21
- 格式:DOCX
- 页数:41
- 大小:33.42KB
000287V343.docx
《000287V343.docx》由会员分享,可在线阅读,更多相关《000287V343.docx(41页珍藏版)》请在冰点文库上搜索。
000287V343
Exam:
IBM000-287
Title:
Test287,enterpriseappl.dev.withwebspherestudiov5.0
Version:
V3.43
1.Adeveloperdiscoversthatanexceptionbeingthrownfromabusinessmethodonanentitybeandoesnotcausethetransactiontorollback;arollbackwasexpected.Whatwouldcorrectthisproblem?
A.Ensurethatthebusinessmethodthrowsaninstanceofjavax.jts.TransactionRolledbackException.
B.EnsurethatthebusinessmethodmarksthecurrenttransactionforrollbackbycallingthesetRollbackOnly()methodontheEJBContext.
C.Callrollback()onthecurrentUserTransactionobject.
D.Callrollback()ontheEJBContext.
E.callsetRollbackOnly()ontheUserTransactionobject.
Answer:
B
2.Adeveloperiswritingatask()method,inasessionbean,whichmakesuseofseveralentitybeanstoperformatask.ThesessionbeanmustrecordtheinvocationofthetaskusingaLogEntryentitybean.ThelogentrymustNOTbemadeifthetaskfails.AssumethattheLogEntrybeanisconfiguredwith'Supports'.InordertoGUARANTEEthisbehavior,thetask()methodofthesessionbeanshouldbeconfiguredas:
A.bean-managedtransactionandexplicitlybeginanUserTransactionbeforecreatingtheLogEntryinstanceandperformingthetasklogic.Finally,havethetask()methodcommitorrollbackthetransactionbasedonthesuccess/failureofthetask.
B.'Supports'.Withinthetask()method,createtheLogEntryinstanceandperformthetasklogic.Finally,havethetaskmethod()callsessionContext.setRollBackOnly()ifthetasklogicfails.
C.'RequiresNew'.Withinthemethod,createtheLogEntryinstanceandperformthetasklogic.Finally,havethetask()methodcallsessionContext.setRollBackOnly()ifthetaskfails.
D.'Mandatory'.Withinthemethod,createtheLogEntryinstanceandperformthetasklogic.Finally,havethetask()methodcallsessionContext.setRollBackOnly()ifthetaskfails.
Answer:
AC
3.WhiledevelopinganEJBforanEJB2.0compliantserver,adeveloperrunsintoaproblem.WheneverthemethodejbContext.getUserTransaction()iscalled,anIllegalStateExceptionisthrown.Whichofthefollowingarepossiblecausesforthisbehavior?
A.Thebeanisanentitybean.
B.Thebeanisasessionbean.
C.Atransactionhasnotbeenstarted.
D.Container-managedtransactiondemarcationisbeingused.
Answer:
AD
4.CustomerandAddressareBMPentitybeans.TheejbCreatemethodforCustomerispassedvaluesforthepropertiesoftheCustomer'saddressanditisnecessarytoensurethatanAddressEntityiscreatedaspartofthesametransactionthatcreatestheCustomer.AssumingtheAddressrequiresareferencetotheCustomerandtherearenoforeignkeyconstraintsenforcedbythedatabase,theBESTwaytocreatetheAddressisto:
A.InserttheAddressdataintotheaddresstableintheejbCreatemethodofCustomer.
B.InserttheAddressdataintotheaddresstableintheejbPostCreatemethodofCustomer.
C.Invokethecreate()methodofAddressHomefromtheejbCreatemethodofCustomer.
D.Invokethecreate()methodofAddressHomefromtheejbPostCreatemethodofCustomer.
Answer:
D
5.Adeveloperiswritingasessionbeanwhichmakesuseofseveralentitybeanstoperformatask.ThesessionbeanmustrecordtheinvocationofthetaskusingaLogEntryentitybean.Thelogentrymustbemaderegardlessofthesuccessofthetask.WhatsupportsBESTthisbehavior?
A.Providetwodistinctoperationsonthesessionbeanthatwouldbeinvokedinsequencebytheclientcode;oneforcreatingtheLogEntryandoneforperformingthetask.
B.Use'RequiresNew'transactionattributeontheLogEntrybeantoensurethatthecreationoftheLogEntryoccursonaseparatetransaction.
C.Use'Mandatory'transactionattributeontheLogEntrybeantoensurethatthecreationoftheLogEntryoccursonaseparatetransaction.
D.HavethetasksessionbeaninvokeacreateLogEntry()methodonanothersessionbeantoensurethattheLogEntryiscreatedoutsidethetasktransaction.
Answer:
B
6.Refertotheexhibittoanswerthequestion.Theservletfilter,IntegerFilter,isusedtoretrieveaparameterfromtheHTTPrequest,convertittoanIntegerobjectandstorethisobjectintheHttpServletRequestobjectforlaterusewithinaservlet.Duringstresstestingthefilterisfoundtomixupnumbersobtainedfromdifferentsimultaneousrequests.WhichofthefollowingistheBESTwaytofixtheproblem?
A.MaketheIntegeralocalvariableofthedoFiltermethod.
B.SynchronizethedoFiltermethodofthefilterclass.
C.AddSingleThreadModeltotheimplementsclauseoftheclassdefinition.
D.PlacethecalltosetAttributeinasynchronizedblock.
Answer:
A
7.Refertotheexhibittoanswerthequestion.AJSP,productlist.jsp,containsalinkforeachavailableproductwhichsendsinformationabouttheproducttoAddItemToBasketServletasparametersoftheHTTPPOSTrequest.Duringtesting,thedeveloperfindsthattheapplicationbehavescorrectly,addinganitemtothebasketandreturningtheclienttotheproductlisttoselectmoreitems.Afterdeploymenttotheproductionenvironment,however,usersfindthatthesystemfailstocorrectlyrecorditemswhen"shoppingforseveralitemsatthesametime".WhichofthefollowingistheBESTwaytofixthisproblem?
A.SynchronizetheaddItemmethodoftheBasketclass.
B.Enablepersistentsessionsintheserverconfiguration.
C.UseURLrewritingforstorageofthesessionID.
D.SynchronizethedoPostmethodofAddItemToBasketServlet.
Answer:
A
8.GiventhatthefollowingJSPpagedirectivehasbeendefinedintheJSPpage,whichimplicitobjectsareavailableforuseinJSPscriptletsandexpressions?
(%@pageisThreadSafe="true"isErrorPage="true"errorPage="error.html"%)
A.request
B.error
C.page
D.in
E.out
Answer:
ACE
9.Examinationofthelogsofaproductionwebapplicationhaverevealedthatsomeservlets,whichformpartofaninternaltestingframework,arebeinginvokedbyexternalusers,eventhoughthetestservletsarenotmappedtoURLsintheweb.xmlfile.WhichofthefollowingwouldbetheBESTwaytofixthisproblem?
A.Uncheckthe"Serveservletsbyclassname"checkboxintheExtensionspageoftheWebDeploymentDescriptoreditor.
B.Checkthe"Onlyservemappedservlets"checkboxintheServletspageoftheWebDeploymentDescriptoreditor.
C.Addmappingsforthetestservletstotheweb.xmlfile.
D.RemovetheclassnamesforthetestservletsfromtheMANIFEST.MFfileforthewebapplication.
Answer:
A
10.Partofthe"pagetemplate",tobereturnedtothebrowserasaresultofexecutingaJSP,isHTMLwhichisupdateddaily,e.g.,a"PressReleases"section.ThisisBESTdoneusingwhichofthefollowingtags?
A.<%@forwardfile="/pages/press_releases.html"%>
B.<%@includefile="/pages/press_releases.html"%>
C.<jsp:
includepage="/pages/press_releases.html"/>
D.<jsp:
forwardpage="/pages/press_releases.html"/>
Answer:
C
11.Aproductionwebapplicationcontainsmanyservlets,eachrepresentingoneoperation,whichausercanperformintheapplication.Thedeveloperresponsiblefortheapplicationfindsthatitishardtomaintainandprovidesfewopportunitiesforreuseofclasses.WhichofthefollowingwouldbetheBESTwaytoaddresstheseshortcomings?
A.ReplacethemanyservletswithasingleservletanduseobjectsimplementingtheCommanddesignpatterntomanagerequestprocessing.
B.Relocatethebusinesslogictoresideintheservletclasses,toreducethenumberofclassesintheapplication.
C.Addasingleservlettoreceiverequestsfromtheuserandthenusearules-basedmechanismfordecidingwhichofthemanyservletstoforwardtherequestto.
D.MovethecontrollerlogicfromtheservletstotheJSPs,toreducethenumberofaddressableresourcesintheapplication.
Answer:
A
12.Thefollowingcodefragmentshowsthecreationofasessionobjectwithinaservlet(requestisanobjectoftypeHttpServletRequest,flagisabooleanvalue):
HttpSessionsession=request.getSession(flag);
WhichofthefollowingstatementsareTRUEafterthislineofcodehasbeenexecuted?
A.Ifflagistrue,sessionalwayscontainsareferencetoanewHttpSessionobject.
B.IfflagistrueandnoHttpSessionobjectcurrentlyexistsforthisclient,sessioncontainsareferencetoanewHttpSessionobject.
C.IfflagisfalseandnoHttpSessionobjectcurrentlyexistsforthisclient,sessionisnull.
D.IfflagisfalseandnoHttpSessionobjectcurrentlyexistsforthisclient,anexceptionisthrown.
E.Ifflagisfalse,anewHttpSessionobjectcannotbecreatedbecausethesessionmanager'smaximumlimitshavebeenreached.
Answer:
BC
13.Aservlethassavedaninstanceofacom.ibm.ShoppingCartbeantothesessionobject.TheshoppingcartinformationhastobedisplayedusingaJSPpage.WhichJSPtagswouldallowforaccessingthebeanfromtheJSPpage?
A.<jsp:
useBeanid="cart"class="com.ibm.ShoppingCart"/>
B.<jsp:
useBeanid="cart"scope="session"class="com.ibm.ShoppingCart"/>
C.<jsp:
useBeanid="cart"scope="session"type="com.ibm.ShoppingCart"/>
D.<jsp:
useBeanid="cart"scope="request"type="com.ibm.ShoppingCart"/>
Answer:
BC
14.WhichofthefollowingtasksMUSTbecompletedbeforeaJSPcustomtagimplementationclasscanbeusedinaJSP?
A.Thedefinitionofthetagmustbeaddedtothetaglibrarydescriptor.
B.ThetaglibraryURImustbespecifiedinataglibdirective.
C.Customtagsmustbeenabledinthewebdeploymentdescriptor.
D.Themappingforthecustomtagmustbedefinedinthewebdeploymentdescriptor.
E.Thetaglibmodulemustbeplacedinthewebapplication'slibdirectory.
Answer:
AB
15.Aservlet,whichextendsHtt
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 000287 V343
![提示](https://static.bingdoc.com/images/bang_tan.gif)