1Z0-809-CHS Java SE 8 Programmer II認(rèn)證考試題庫(附答案)_第1頁
1Z0-809-CHS Java SE 8 Programmer II認(rèn)證考試題庫(附答案)_第2頁
1Z0-809-CHS Java SE 8 Programmer II認(rèn)證考試題庫(附答案)_第3頁
1Z0-809-CHS Java SE 8 Programmer II認(rèn)證考試題庫(附答案)_第4頁
1Z0-809-CHS Java SE 8 Programmer II認(rèn)證考試題庫(附答案)_第5頁
已閱讀5頁,還剩99頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

PAGEPAGE11Z0-809-CHS:JavaSE8ProgrammerII認(rèn)證考試題庫(附答案)一、單選題1.Giventhecodefragment:

Whichstatementistrue?A、TheprogramprintsCallCallandterminates.B、TheprogramprintsCallCallanddoesnotterminate.C、Apilationerroroccursatlinen1.D、AnExecutionExceptionisthrownatruntime.答案:B2.Given:

Whatistheresult?A、0B、2C、3D、4E、5答案:D3.Giventhecodefragment:

Whatistheresult?A、0B、1C、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:A4.GiventherecordsfromtheSTUDENTtable:

Giventhecodefragment:

AssumethattheURL,username,andpasswordarevalid.

Whatistheresult?A、TheSTUDENTtableisnotupdatedandtheprogramprints:114:John:johnuni.B、TheSTUDENTtableisupdatedwiththerecord:113:Jannet:jannetuni.andtheprogramprints:114:John:johnuni.C、TheSTUDENTtableisupdatedwiththerecord:113:Jannet:jannetuni.andtheprogramprints:113:Jannet:jannetuni.D、ASQLExceptionisthrownatruntime.答案:D5.Giventhecodefragments:

WhichmodificationenablesthecodetoprintTryagain?A、mentthelines28,29and30.B、Replaceline26with:}catch(Exception|ArithmeticException|NumberFormatExceptione){C、Replaceline26with:}catch(ArithmeticException|NumberFormatExceptione){D、Replaceline27with:throwe;答案:C6.Given:

WhichcodefragmentcreatesaninstanceofCar?A、Carauto=Car(“MyCar”)::new;B、Carauto=Car::new;Carvehicle=auto::getCar(“MyCar”);C、Rideablerider=Car::new;Carvehicle=rider.getCar(“MyCar”);D、Carvehicle=Rideable::new::getCar(“MyCar”);答案:C7.Giventhecodefragment:Whatistheresult?A、DavidDavid[Susan,Allen]B、SusanSusan[Susan,Allen]C、SusanAllen[David]D、DavidAllen[Susan]E、SusanAllen[Susan,David]答案:C8.Giventhecodefragment:

Whatistheresult?A、DOCMPEGJPEGMPEGJPEGB、DOCMPEGMPEGJPEGMPEGMPEGJPEGC、MPEGJPEGMPEGJPEGD、Theorderoftheoutputisunpredictable.答案:A9.Giventhecodefragments:

Whatistheresult?A、TheprogramprintsRun…andthrowsanexception.B、Apilationerroroccursatlinen1.C、Run…Call…D、Apilationerroroccursatlinen2.答案:C10.Given:

andthecodefragment:

Whichstatementistrue?A、Theprogramprintstrue.B、Theprogramprintsfalse.C、Apilationerroroccurs.Toensuresuccessfulpilation,replacelinen1with:booleanequals(Bookobj){D、Apilationerroroccurs.Toensuresuccessfulpilation,replacelinen2with:System.out.println(b1.equals((Object)b2));答案:A11.GiventhedefinitionoftheCountryclass:

Andthecodefragment:

A、{EUROPE=[Italy,Germany],ASIA=[Japan]}B、{ASIA=[Japan],EUROPE=[Italy,Germany]}C、{EUROPE=[Germany,Italy],ASIA=[Japan]}D、{EUROPE=[Germany],EUROPE=[Italy],ASIA=[Japan]}答案:B12.Giventhecodefragment:Whatistheresult?A、[X][X,X][X,X,X][X,X,X,X]B、[X,X]C、[X][X,X][X,X,X]D、[X,X][X,X,X,X]答案:D13.Giventhecontentoftheemployee.txtfile:

Everyworkerisamaster.

Giventhattheemployee.txtfileisaccessibleandthefileallemp.txtdoesNOTexist,andthecodefragment:

Whatistheresult?A、Exception1B、Exception2C、Theprogramexecutes,doesNOTaffectthesystem,andproducesNOoutput.D、allemp.txtiscreatedandthecontentofemployee.txtiscopiedtoit.答案:A14.Giventhecodefragment:

Whatistheresult?A、4000.0B、4000C、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:D15.Thedata.doc,data.txtanddata.xmlfilesareaccessibleandcontaintext.Giventhecodefragment:

Whatistheresult?A、Theprogramprintsthecontentofdata.txtfile.B、Theprogramprints:Exception<>ExceptionC、Apilationerroroccursatlinen1.D、Theprogramprintsthecontentofthethreefiles.答案:A16.Giventhecodefragment:

Whatistheresult?A、246B、Thecodeproducesnooutput.C、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:A17.

andthecodefragment?

Whatistheresult?A、$15.00B、15$C、USD15.00D、USD$15答案:A18.Giventhecodefragment:

Assumethat:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseisaccessiblewiththedbURL,userName,andpassWordexists.

TheEmployeeandCustomertablesareavailableandeachtablehasidcolumnwithafewrecordsandtheSQLqueriesarevalid.

Whatistheresultofpilingandexecutingthiscodefragment?A、TheprogramprintsemployeeIDs.B、TheprogramprintscustomerIDs.C、TheprogramprintsError.D、pilationfailsonline13.答案:C19.Giventhecodefragment:

Whatistheresult?A、Afilewiththenamelog.txtiscreatedinthe/datadirectoryandthecontentofthe/data/december/log.txtfileiscopiedtoit.B、TheprogramexecutessuccessfullyanddoesNOTchangethefilesystem.C、AFileNotFoundExceptionisthrownatruntime.D、AFileAlreadyExistsExceptionisthrownatruntime.答案:D20.Whichclassdefinitionpiles?A、B、C、D、答案:B21.WhichstatementistrueabouttheDriverManagerclass?A、ItreturnsaninstanceofConnection.B、itexecutesSQLstatementsagainstthedatabase.C、Itonlyqueriesmetadataofthedatabase.D、itiswrittenbydifferentvendorsfortheirspecificdatabase.答案:A22.Giventhecodefragments:Whatistheresult?A、[AGuidetoJavaTour:3.0,BeginningwithJava:2.0]B、[BeginningwithJava:2,AGuidetoJavaTour:3]C、ApilationerroroccursbecausetheBookclassdoesnotoverridetheabstractmethodpareTo().D、AnExceptionisthrownatruntime.答案:A23.Giventhecodefragment:

AssumethatthePicsdirectorydoesNOTexist.Whatistheresult?A、Anexceptionisthrownatruntime.B、2:MyPic.jpeg:MyPic.jpegC、1:Pics:/Pics/MyPic.jpegD、2:Pics:MyPic.jpeg答案:B24.Giventhecodefragment:

AssumethatthereadymethodoftheBufferedReader,whencalledonaclosedBufferedReader,throwsanexception,andemployee.txtisaccessibleandcontainsvalidtext.Whatistheresult?A、Apilationerroroccursatlinen3.B、Apilationerroroccursatlinen1.C、Apilationerroroccursatlinen2.D、Thecodeprintsthecontentoftheemployee.txtfileandthrowsanexceptionatlinen3.答案:D25.Whichstatementistrueaboutjava.util.stream.Stream?A、Astreamcannotbeconsumedmorethanonce.B、Theexecutionmodeofstreamscanbechangedduringprocessing.C、Streamsareintendedtomodifythesourcedata.D、Aparallelstreamisalwaysfasterthananequivalentsequentialstream.答案:A26.Giventhecodefragment:

Whatistheresult?A、100,Robin,HR101,Peter,HRB、Apilationerroroccursatlinen1.C、100,Robin,HR101,Peter,HR200,Mary,AdminServicesD、100,Robin,HR200,Mary,AdminServices101,Peter,HR答案:A27.Given:

Andthecodefragment:

YouhavebeenaskedtoensurethattherunmethodsofboththeWorkerandMasterclassesareexecuted.Whichmodificationmeetstherequirement?A、Atlinen2,insertCyclicBarriercb=newCyclicBarrier(2,master);B、Replacelinen1withclassMasterextendsThread{C、Atlinen2,insertCyclicBarriercb=newCyclicBarrier(1,master);D、Atlinen2,insertCyclicBarriercb=newCyclicBarrier(master);答案:C28.Given:

andthecodefragment:

WhichmodificationenablesthecodefragmenttoprintSpeaker?A、ImplementPredicateintheProduct.ProductFilterclassandreplacelinen2with.filter(p->p.ProductFilter.test(p))B、Replacelinen1with:publicstaticbooleanisAvailable(Productp){C、Replacelinen2with:.filter(p->p.ProductFilter::isAvailable(p))D、Replacelinen2with:.filter(p->Product::ProductFilter::isAvailable())答案:B29.Giventhecodefragment:Whichshouldbeinsertedintolinen1toprintAverage=2.5?A、IntStreamstr=Stream.of(1,2,3,4);B、IntStreamstr=IntStream.of(1,2,3,4);C、DoubleStreamstr=Stream.of(1.0,2.0,3.0,4.0);D、Streamstr=Stream.of(1,2,3,4);答案:B30.GiventherecordsfromtheEmployeetable:

Andgiventhecodefragment:

Assumethat:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseaccessiblewiththeURL,userName,andpassWordexists.

Whatistheresult?A、TheEmployeetableisupdatedwiththerow:112Jackandtheprogramprints:112JerryB、TheEmployeetableisupdatedwiththerow:112Jackandtheprogramprints:112JackC、TheEmployeetableisnotupdatedandtheprogramprints:112JerryD、TheprogramprintsExceptionisraised.答案:C31.Giventhecontent:

Andthecodefragment:

Whatistheresult?A、username=Entrezlenomd’utilisateurpassword=EntrezlemotdepasseB、username=EnterUserNamepassword=EnterPasswordC、Apilationerroroccurs.D、Theprogramprintsnothing.答案:A32.Giventhecodefragments:

Whatistheresult?A、FranceOptional[NotFound]B、Optional[France]Optional[NotFound]C、Optional[France]NotFoundD、FranceNotFound答案:D33.Giventhecodefragment:

Whichstatementcanbeinsertedintolinen1toprint1,2;1,10;2,20;?A、BiConsumerc=(i,j)->{System.out.print(i+“,”+j+“;“);};B、BiFunctionc=(i,j)–>{System.out.print(i+“,”+j+“;“)};C、BiConsumerc=(i,j)–>{System.out.print(i+“,”+j+“;“)};D、BiConsumerc=(i,j)–>{System.out.print(i+“,”+j+“;“);};答案:A34.Given:Whichoptionfails?A、Foomark=newFoo(“Steve”,100);B、Foopair=Foo.twice(“HelloWorld!”);C、Foopercentage=newFoo(“Steve”,100);D、Foograde=newFoo<>(“John”,“A”);答案:C35.Giventhecodefragment:Whatistheresult?A、0:0:penB、0:1:penC、0:0:0:0:0:penD、0:1:2:3:4:E、Apilationerroroccurs.答案:A36.GiventhestructureoftheSTUDENTtable:

Student(idINTEGER,nameVARCHAR)

Given:

Assumethat:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseisaccessiblewiththeURL,userName,andpassWordexists.

TheSQLqueryisvalid.

Whatistheresult?A、TheprogramexecutessuccessfullyandtheSTUDENTtableisupdatedwithonerecord.B、TheprogramexecutessuccessfullyandtheSTUDENTtableisNOTupdatedwithanyrecord.C、ASQLExceptionisthrownasruntime.D、ANullPointerExceptionisthrownasruntime.答案:C37.Giventhecodefragment:A、Apilationerroroccurs.B、dbezjC、jzebdD、zbdej答案:C38.Given:

Whatistheresult?A、Anexceptionisthrownatlinen2.B、100C、Apilationerroroccursbecausethetryblockisdeclaredwithoutacatchorfinallyblock.D、Apilationerroroccursatlinen1.答案:B39.Giventhecodefragment:

Whatistheresult?A、Hello:JimHello:JohnHello:JeffB、JimJohnJeffC、Theprogramprintsnothing.D、Apilationerroroccurs.答案:C40.Giventhecodefragment:

Whatistheresult?A、Apilationerroroccursatlinen1.B、Checking…C、Checking…Checking…D、Apilationerroroccursatlinen2.答案:D41.Giventhecodefragment:

Whatistheresult?A、20B、20.5C、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:C42.Giventhecodefragment:

Whatistheresult?A、text1text2B、text1text2text2text3C、text1D、[text1,text2]答案:A43.Giventhecodefragment:

Whatistheresult?A、/app/sys/log/readme/server/exeB、/app/log/sys/server/exe/readmeC、/app/./sys/log/readmeD、/app/./sys/log/server/exe/readme答案:C44.GiventhedefinitionoftheVehicleclass:WhichactionencapsulatestheVehicleclass?A、MaketheVehicleclasspublic.B、Makethenamevariablepublic.C、MakethesetNamemethodpublic.D、Makethenamevariableprivate.E、MakethesetNamemethodprivate.F、MakethegetNamemethodprivate.答案:D45.Giventhecodefragment:

Whatistheresult?A、JavaEEJavaEESEB、JavaEESEC、Theprogramprintseither:JavaEEJavaSEorJavaSEJavaEED、JavaEEJavaSE答案:D46.Giventhecodefragment:

Whichcodefragment,wheninsertedatlinen1,enablesthecodetoprint/First.txt?A、PathiP=newPaths(“/First.txt”);B、PathiP=Paths.toPath(“/First.txt”);C、PathiP=newPath(“/First.txt”);D、PathiP=Paths.get(“/”,“First.txt”);答案:D47.Giventhecodefragment:

Whatistheresult?A、Allfilesanddirectoriesunderthehomedirectoryarelistedalongwiththeirattributes.B、Apilationerroroccursatlinen1.C、Thefilesinthehomedirectoryarelistedalongwiththeirattributes.D、Apilationerroroccursatlinen2.答案:A48.Giventhecodefragment:

AssumethatProjectscontainssubdirectoriesthatcontain.classfilesandispassedasanargumenttotherecDelete()methodwhenitisinvoked.Whatistheresult?A、Themethoddeletesallthe.classfilesintheProjectsdirectoryanditssubdirectories.B、Themethoddeletesthe.classfilesoftheProjectsdirectoryonly.C、ThemethodexecutesanddoesnotmakeanychangestotheProjectsdirectory.D、ThemethodthrowsanIOException.答案:A49.In2015,daylightsavingtimeinNewYork,USA,beginsonMarch8that2:00AM.Asaresult,2:00AMbees3:00AM.

Giventhecodefragment:

Whichistheresult?A、3:00–difference:2B、2:00–difference:1C、4:00–difference:3D、4:00–difference:2答案:D50.Given:

Whichcodefragmentshouldbeinsertedatlinen1toenablethecodetoprintRatCatLionTiger?A、Arrays.sort(strArray,CheckClass::checkValue);B、Arrays.sort(strArray,(CheckClass::new)::checkValue);C、Arrays.sort(strArray,(CheckClass::new).checkValue);D、Arrays.sort(strArray,CheckClass::new::checkValue);答案:A51.Given:

Andthecodefragment:

WhichmodificationenablesthecodefragmenttoprintHappyJourney!?A、Replacelinen1withpublicvoidride()throwsFuelNotAvailException{B、Replacelinen1withprotectedvoidride()throwsException{C、Replacelinen2withvoidride()throwsException{D、Replacelinen2withprivatevoidride()throwsFuelNotAvailException{答案:B52.Given:

Whichstatementistrue?A、Moveablecanbeusedasbelow:Moveableanimal=n->System.out.println(“Running”+n);animal.run(100);animal.walk(20);B、Moveablecanbeusedasbelow:Moveableanimal=n->n+10;animal.run(100);animal.walk(20);C、Moveablecanbeusedasbelow:Moveableanimal=(Integern)->System.out.println(n);animal.run(100);Moveable.walk(20);D、Movablecannotbeusedinalambdaexpression.答案:A53.Assumecustomers.txtisaccessibleandcontainsmultiplelines.Whichcodefragmentprintsthecontentsofthecustomers.txtfile?A、Streamstream=Files.find(Paths.get(“customers.txt”));stream.forEach((Stringc)->System.out.println(c));B、Streamstream=Files.find(Paths.get(“customers.txt”));stream.forEach(c)->System.out.println(c));C、Streamstream=Files.list(Paths.get(“customers.txt”));stream.forEach(c)->System.out.println(c));D、Streamlines=Files.lines(Paths.get(“customers.txt”));lines.forEach(c)->System.out.println(c));答案:D54.Given:Whatistheresult?A、0B、Apilationerroroccursatlinen1.C、AnExceptionisthrownatruntime.D、2答案:A55.Given:

Andthecodefragment:

Whatistheresult?A、[JavaEE:Helen:Houston][JavaME:Jessy:Chicago,JavaME:Mark:Chicago]B、JavaEEJavaMEC、[JavaME:Jessy:Chicago,JavaME:Mark:Chicago][JavaEE:Helen:Houston]D、Apilationerroroccurs.答案:B56.Giventhecodefragment:

andtheinformation:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseisaccessiblewiththedbURL,username,andpassWordexists.

Whatistheresult?A、AClassNotFoundExceptionisthrownatruntime.B、Theprogramprintsnothing.C、TheprogramprintsConnectionEstablished.D、ASQLExceptionisthrownatruntime.答案:C57.Giventhatthesefilesexistandareaccessible:

Whichcodefragmentcanbeinsertedatlinen1toenablethecodetoprintonly/pany/emp?A、Streamstream=Files.list(Paths.get(“/pany”));B、Streamstream=Files.find(Paths.get(“/pany”),1,(p,b)–>b.isDirectory(),FileVisitOption.FOLLOW_LINKS);C、Streamstream=Files.walk(Paths.get(“/pany”));D、Streamstream=Files.list(Paths.get(“/pany/emp”));答案:B58.Giventhecodefragment:

Assumethecourses.txtisaccessible.Whichcodefragmentcanbeinsertedatlinen1toenablethecodetoprintthecontentofthecourses.txtfile?A、Listfc=Files.list(file);fc.stream().forEach(s->System.out.println(s));B、Streamfc=Files.readAllLines(file);fc.forEach(s->System.out.println(s));C、Listfc=readAllLines(file);fc.stream().forEach(s->System.out.println(s));D、Streamfc=Files.lines(file);fc.forEach(s->System.out.println(s));答案:D59.Giventhecodefragment:

Whatistheresult?A、Traveltimeis4hoursB、Traveltimeis6hoursC、Traveltimeis8hoursD、Anexceptionisthrownatlinen1.答案:A60.Giventhecodefragments:

Whatistheresult?A、2B、3C、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:B61.Giventhecodefragment:Whatistheresult?A、Apilationerroroccursatlinen1.B、Apilationerroroccursatlinen2.C、Thecodereadsthepasswordwithoutechoingcharactersontheconsole.D、ApilationerroroccursbecausetheIOExceptionisn’tdeclaredtobethrownorcaught?答案:C62.Giventhecodefragment:Whichcodefragment,wheninsertedatlinen1,ensuresfalseisprinted?A、booleanb=cs.stream().findAny().get().equals(“Java”);B、booleanb=cs.stream().anyMatch(w->w.equals(“Java”));C、booleanb=cs.stream().findFirst().get().equals(“Java”);D、booleanb=cs.stream().allMatch(w->w.equals(“Java”));答案:D63.Giventhecodefragment:

Whatistheresult?A、Val:20Val:40Val:60B、Val:10Val:20Val:30C、Apilationerroroccurs.D、Val:Val:Val:答案:A64.Giventhatcourse.txtisaccessibleandcontains:

Course::Java

Andgiventhecodefragment:

Whatistheresult?A、ur::vaB、ueJaC、Theprogramprintsnothing.D、Apilationerroroccursatlinen1.答案:B65.GiventhestructureoftheStudenttable:

Student(idINTEGER,nameVARCHAR)

GiventherecordsfromtheSTUDENTtable:

Giventhecodefragment:

Assumethat:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseisaccessiblewiththedbURL,userName,andpassWordexists.Whatistheresult?A、TheprogramprintsStatus:trueandtworecordsaredeletedfromtheStudenttable.B、TheprogramprintsStatus:falseandtworecordsaredeletedfromtheStudenttable.C、ASQLExceptionisthrownatruntime.D、TheprogramprintsStatus:falsebuttherecordsfromtheStudenttablearenotdeleted.答案:B66.Giventhecodefragment:Whatistheresult?A、4000:2000B、4000:1000C、1000:4000D、1000:2000答案:A67.Giventhecodefragment:

WhichisthevaliddefinitionoftheCourseenum?A、B、C、D、答案:D68.Giventhecodefragments:

Whichcodefragmentcanbeinsertedatlinen1tostartr1andc1threads?A、Futuref1=(Future)es.submit(r1);es.execute(c1);B、es.execute(r1);Futuref1=es.execute(c1);C、Futuref1=(Future)es.execute(r1);Futuref2=(Future)es.execute(c1);D、es.submit(r1);Futuref1=es.submit(c1);答案:D69.Giventhecodefragment:

Whatistheresult?A、Apilationerroroccursatlinen1.B、Loggedoutat:2015-01-12T21:58:19.880ZC、Can’tlogoutD、Loggedoutat:2015-01-12T21:58:00Z答案:C70.Giventhecodefragment:

Assumethatthevalueofnowis6:30inthemorning.

Whatistheresult?A、Anexceptionisthrownatruntime.B、0C、60D、1答案:C71.Given:

Whatistheresult?A、0.0B、1500.0C、Apilationerroroccurs.D、2000.0答案:B72.Giventhecodefragment:Whatistheresult?A、Apilationerroroccursatlinen1.B、courseJavaC、JavacourseD、Apilationerroroccursatlinen2.答案:D解析:c接收的參數(shù)為String,而strBuf不是String,編譯報(bào)錯(cuò)73.Giventhecodefragment:

AssumethatdbURL,userName,andpasswordarevalid.

Whichcodefragmentcanbeinsertedatlinen1toenablethecodetoprintConnectionEstablished?A、Propertiesprop=newProperties();prop.put(“user”,userName);prop.put(“password”,password);con=DriverManager.getConnection(dbURL,prop);B、con=DriverManager.getConnection(userName,password,dbURL);C、Propertiesprop=newProperties();prop.put(“userid”,userName);prop.put(“password”,password);prop.put(“url”,dbURL);con=DriverManager.getConnection(prop);D、con=DriverManager.getConnection(dbURL);con.setClientInfo(“user”,userName);con.setClientInfo(“password”,password);答案:A74.Given:

Assumethat:

Therequireddatabasedriverisconfiguredintheclasspath.

TheappropriatedatabaseisaccessiblewiththedbURL,userName,andpassWordexists.

TheSQLqueryisvalid.

Whatistheresult?A、Anexceptionisthrownatruntime.B、pilationfails.C、ThecodeprintsError.D、ThecodeprintsinformationaboutItem110.答案:D75.Giventhecodefragments:

Whichshouldbeinsertedatlinen1toprintJava-OracleDB-J2EE-?A、stre.forEach(System.out::print);B、stre.map(a->a.techName).forEach(System.out::print);C、stre.map(a->a).forEachOrdered(System.out::print);D、stre.forEachOrdered(System.out::print);答案:B76.Giventhatversion.txtisaccessibleandcontains:

1234567890

Andgiventhecodefragment:

Whatistheresult?A、121B、122C、135D、Theprogramprintsnothing.答案:B77.GiventhedefinitionoftheBookclass:

WhichstatementistrueabouttheBookclass?A、Itdemonstratesencapsulation.B、Itisdefinedusingthefactorydesignpattern.C、Itisdefinedusingthesingletondesignpattern.D、Itdemonstratespolymorphism.E、Itisanimmutableclass.答案:A78.Whichstatementistrueaboutjava.time.Duration?A、Ittrackstimezones.B、Itpreservesdaylightsavingtime.C、Itdefinestime-basedvalues.D、Itdefinesdate-basedvalues.答案:C79.Given:andthecodefragment:Whatistheresult?A、[JavaEE:Helen:Houston][JavaME:Jessy:Chicago,JavaME:Mark:Chicago]B、JavaEEJavaMEC、[JavaME:Jessy:Chicago,JavaME:Mark:Chicago][JavaEE:Helen:Houston]D、Apilationerroroccurs.答案:B80.Giventhecodefragment:YouhavebeenaskedtodefinetheProductCodeclass.ThedefinitionoftheProductCodeclassmustallowc1instantiationtosucceedandcauseapilationerroronc2instantiation.WhichdefinitionofProductCodemeetstherequirement?A、B、C、D、答案:C81.Giventhecodefragments:Whatistheresult?A、Theprogramprints:RunRunnerCallCaller:nullAndtheprogramdoesnotterminate.B、Theprogramterminatesafterprinting:RunRunnerCallCaller:RunC、Apilationerroroccursatlinen1.D、AnExecutionisthrownatruntime.答案:A82.Giventhecodefragment:

Whatistheresult?A、1John2nullB、12C、ANullPointerExceptionisthrownatruntime.D、Apilationerroroccurs.答案:D83.Giventhecodefragment:

Whatistheresult?A、Apilationerroroccurs.B、[Java,J2EE,J2ME,JSTL,JSP]C、nullD、[Java,J2EE,J2ME,JSTL]答案:D84.Giventhecodefragments:

And

Whatistheresult?A、NewYorkB、CityNotavailableC、nullD、ANoSuchElementExceptionisthrownatruntime.答案:B85.Given:

Whatistheresult?A、Java100B、java.lang.stringjava.lang.IntegerC、Apilationerroroccurs.Torectifyit,replacelinen1with:Testtype1=newTest<>();D、Apilationerroroccurs.Torectifyit,replacelinen2with:type1.set(Integer(100));答案:A86.Given:

Whatistheresult?A、Scan.Printerclosed.Scannerclosed.Unabletoscan.B、Scan.Scannerclosed.Unabletoscan.C、Scan.Unabletoscan.D、Scan.Unabletoscan.Printerclosed.答案:A87.Giventhatdata.txtandalldata.txtareaccessible,andthecodefragment:

Whatisrequiredatlinen1toenablethecodetooverwritealldata.txtwithdata.txt?A、br.close();B、bw.writeln();C、br.flush();D、bw.flush();答案:D88.Giventhecodefragment:

Whichcodefragmentmustbeinsertedatlinen1toenablethecodetoprintthemaximumnumberinthenumslist?A、nums.stream().max(parator.paring(a->a)).get()B、nums.stream().max(Integer::max).get()C、nums.stream().max()D、nums.stream().map(a->a).max()答案:A89.Given:

Whatistheresult?A、ReadJavaProgrammingViewhttp:/ebook./ebookB、ReadJavaProgrammingReadhttp:/ebook./ebookC、TheEBook.javafilefailstopile.D、TheTest.javafilefailstopile.答案:D90.Giventhecodefragment:

Whatistheresult?A、20.030.0B、1020C、Apilationerroroccurs.D、ANumberFormatExceptionisthrownatruntime.答案:C91.Giventhecodefragment:Whatistheresult?A、Apilationerroroccursatlinen2.B、200.12300.32C、100.12200.32D、Apilationerroroccursatlinen1.答案:D92.Giventhecodefragment:

Whatistheresult?A、Searching...B、Searching...Searching...C、Searching...Searching...Searching...D、Apilationerroroccurs.答案:A93.Given:andthecodefragment:

Andgiventhatthesumofallintegersfrom1to10is55.Whichstatementistrue?A、Theprogramprintsseveralvaluesthattotal55.B、Theprogramprints55.C、Apilationerroroccursatlinen1.D、Theprogramprintsseveralvalueswhosesumexceeds55.答案:A94.Giventhecodefragments:

Whichstatementistrue?A、Theprogramprints123andtheorderisunpredictable.B、Theprogramprints123.C、Theprogramprints111.D、Apilationerroroccurs.答案:A95.Giventhat/green.txtand/colors/yellow.txtareaccessible,andthecodefragment:Pathsource=Paths.get(“/green.txt);Pathtarget=Paths.get(“/colors/yellow.txt);Files.move(source,target,StandardCopyOption.ATOMIC_MOVE);Files.delete(source);Whichstatementistrue?A、Thegreen.txtfilecontentisreplacedbytheyellow.txtfilecontentandtheyellow.txtfileisdeleted.B、Theyellow.txtfilecontentisreplacedbythegreen.txtfilecontentandanexceptionisthrown.C、Thefilegreen.txtismovedtothe/colorsdirectory.D、AFileAlreadyExistsExceptionisthrownatruntime.答案:B96.Given:

Whatistheresult?A、BarHelloFooHelloB、BarHelloBazHelloC、BazHelloD、ApilationerroroccursintheDazeclass.答案:B97.Given:

Explanation:

Whatistheresult?A、–catch--finally--dostuff[1]B、–catch[1]C、–finally--catch[1]D、–finally-dostuff--catch[1]答案:C98.WhichcodefragmentisrequiredtoloadaJDBC3.0driver?A、Connectioncon=Connection.getDriver(“jdbc:xyzdata://localhost:3306/EmployeeDB”);B、Class.forName(“org.xyzdata.jdbc.NetworkDriver”);C、Connectioncon=DriverManager.getConnection(“jdbc:xyzdata://localhost:3306/EmployeeDB”);D、DriverManager.loadDriver(“org.xyzdata.jdbc.NetworkDriver”);答案:B99.Given:Whichinterfacefromthejava.util.functionpackageshouldyouusetorefactortheclassTxt?A、ConsumerB、PredicateC、SupplierD、Function答案:B100.Given:Whatistheresult?A、IT:nullB、ANullPointerExceptionisthrownatruntime.C、Apilationerroroccurs.D、IT:0.0答案:B101.Giventhecodefragment:

Whichcodefragment,wheninsertedatline1,enablesthecodetoreadtheGDPfromtheuser?A、intGDP=Integer.parseInt(br.readline());B、intGDP=br.read();C、intGDP=br.nextInt();D、intGDP=Integer.parseInt(br.next());答案:A102.Given:

WhichdefinitionoftheColorSorterclasssortstheblockslist?A、B、C、D、答案:C103.Given:

Whatistheresult?A、Userisregistered.B、AnAgeOutOfLimitExceptionisthrown.C、AUserExceptionisthrown.D、Apilationerroroccursinthemainmethod.答案:B104.Giventhecodefragment:

Whatistheresult?A、2016-02-14B、ADateTimeExceptionisthrown.C、2016-02-29D、Apilationerroroccursatlinen1.答案:A105.Giventhecodefragments:

Whatistheresult?A、nullB、Apilationerroroccurs.C、DogCatMouseD、[Dog,Cat,Mouse]答案:B106.Given:

Fromwhatthreadingproblemdoestheprogramsuffer?A、raceconditionB、deadlockC、starvationD、livelock答案:D107.Whatistrueaboutthejava.sql.Statementinterface?A、Itprovidesasessionwiththedatabase.B、ItisusedtogetaninstanceofaConnectionobjectbyusingJDBCdrivers.C、Itprovidesacursortofetchtheresultingdata.D、ItprovidesaclassforexecutingSQLstatementsandreturningtheresults.答案:D108.Giventhecodefragment:Assumethat:Therequireddatabasedriverisconfiguredintheclasspath.TheappropriatedatabaseisaccessiblewiththedbURL,userName,andpassWordexistsTheEmployeetablehasacolumnIDoftypeintegerandtheSQLquerymatchesonerecord.Whatistheresult?A、pilationfailsatline14.B、pilationfailsatline15.C、ThecodeprintstheemployeeID.D、ThecodeprintsError.答案:D解析:java.sql.SQLException:未調(diào)用ResultSet.next,需要while(rs.next)指向后續(xù)才可以取109.GiventhedefinitionoftheEmployeeclass:

Whatistheresult?A、[sales:Ada,hr:Bob,sales:Bob,hr:Eva]B、[Ada:sales,Bob:sales,Bob:hr,Eva:hr]C、[hr:Eva,hr:Bob,sales:Bob,sales:Ada]D、[hr:Bob,hr:Eva,sales:Ada,sales:Bob]答案:D110.Given:Whatistheresultofrunningthecodewiththe–eaoption?A、-10B、0C、AnAssertionErroristhrown.D、Apilationerroroccurs.答案:C111.GiventhedefinitionoftheEmpclass:

Andcodefragment:

Whatistheresult?A、SamJohnJimB、JohnJimC、Apilationerroroccursatlinen1.D、Apilationerroroccursatlinen2.答案:B112.Given:

Andthemand:

Java–eaRateOfInterest

Whatistheresult?A、Rateofinterest:0B、AnAssertionErroristhrown.C、NointerestforthisaccountD、Apilationerroroccursatlinen1.答案:B113.Given:Yourdesignrequiresthat:FuelLevelofEnginemustbegreaterthanzerowhenthestart()methodisinvoked.ThecodemustterminateiffuelLevelofEngineislessthanorequaltozero.Whichcodefragmentshouldbeaddedatlinen1toexpressthisinvariantcondition?A、assert(fuelLevel):“Terminating…”;B、assert(fuelLevel>0):System.out.println(“Impossiblefuel”);C、assertfuelLevel<0:System.exit(0);D、assertfuelLevel>0:“Impossiblefuel”;答案:D解析:assertboolean:String,定義114.Given:

Andthiscodefragment:

Whatistheresult?A、10123Ford10124BMWB、10124BMW10123FordC、Apilationerroroccurs.D、AClassCastExceptionisthrownatruntime.答案:D115.WhichactioncanbeusedtoloadadatabasedriverbyusingJDBC3.0?A、AddthedriverclasstotheMETA-INF/servicesfolderoftheJARfile.B、IncludetheJDBCpertiesfile.C、Usethejava.lang.Class.forNamemethodtoloadthedriverclass.D、UsetheDriverManager.getDrivermethodtoloadthedriverclass.答案:C116.Given:

Andthecodefragment:

Whatistheresult?A、truetrueB、falsetrueC、falsefalseD、truefalse答案:D117.Given:Andthecodefragment:Whichcodefragment,wheninsertedatlinen1,sortstheemployeeslistindescendingorderoffNameandthenascendingorderoflName?A、sorted(parator.paring(Emp::getfName).reserved().thenparing(Emp::getlName))B、sorted(parator.paring(Emp::getfName).thenparing(Emp::getlName))C、map(Emp::getfName).sorted(parator.reserveOrder())D、map(Emp::getfName).sorted(parator.reserveOrder().map(Emp::getlName).reserved答案:A118.Giventhecontentof/resourses/Mperties:

Wele1=”Goodday!”

Andgiventhecodefragment:

Whatistheresult?A、Goodday!TestfollowedbyanExceptionstacktraceB、Goodday!followedbyanExceptionstacktraceC、Goodday!TestnullD、Apilationerroroccursatlinen1.答案:C119.Giventhecodefragment:Whichcodefragment,wheninsertedatline7,enablesprinting100?A、FunctionfunRef=e–>e+10;Integerresult=funRef.apply(value);B、IntFunctionfunRef=e–>e+10;Integerresult=funRef.apply(10);C、ToIntFunctionfunRef=e–>e+10;intresult=funRef.applyAsInt(value);D、ToIntFunctionfunRef=e–>e+10;intresult=funRef.apply(value);答案:C120.Given:

Andthemand:

JavaProduct0

Whatistheresult?A、AnAssertionErroristhrown.B、Apilationerroroccursatlinen1.C、NewPrice:0.0D、ANumberFormatExceptionisthrownatruntime.答案:C121.Giventhecodefragment:

Whatistheresult?A、{1007=

A,1002=

C,1001=

B,1003=B}B、{1001=

B,1002=

C,1003=

B,1007=A}C、{1002=

C,1003=

B,1007=A}D、{1007=

A,1001=

B,1003=

B,1002=C}答案:B122.GiventheGpertiesfile,containing:

Wh

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論