单项选择题

A.ThetimetofindthevaluefromHashMapwithaPersonkeydependsonthesizeofthemap.
B.DeletingaPersonkeyfromaHashMapwilldeleteallmapentriesforallkeysoftypePerson.
C.InsertingasecondPersonobjectintoaHashSetwillcausethefirstPersonobjecttoberemovedasaduplicate.
D.ThetimetodeterminewhetheraPersonobjectiscontainedinaHashSetisconstantanddoesNOTdependonthesizeofthemap.
相关考题

单项选择题 33.Dated=newDate(0);34.Stringds=December15,2004”;35.//insertcodehere36.try{37.d=df.parse(ds);38.}39.catch(ParseExceptione){40.System.out.println(”Unabletoparse+ds);41.}42.//insertcodeheretooWhichwillcreatetheappropriateDateFormatobjectandaddadaytotheDateobject?()A.35.DateFormatdf=DateFormat.getDateFormat();42.d.setTime((60*60*24)+d.getTime());B.35.DateFormatdf=DateFormat.getDateJnstance();42.d.setTime((1000*60*60*24)+d.getTime());C.35.DateFormatdf=DateFormat.getDateFormat();42.d.setLocalTime((1000*60*60*24)+d.getLocalTime());D.35.DateFormatdf=DateFormat.getDateJnstance();42.d.setLocalTime((60*60*24)+d.getLocalTime());

单项选择题 Given:ArrayLista=newArrayList();containingthevalues{1”,2”,3”,4”,5”,6”,7”,8”}Whichcodewillreturn2?()

单项选择题 34.HashMapprops=newHashMap();35.props.put(”key45”,somevalue”);36.props.put(”key12”,someothervalue”);37.props.put(”key39”,yetanothervalue”);38.Sets=props.keySet();39.//insertcodehereWhat,insertedatline39,willsortthekeysinthepropsHashMap?()A.Arrays.sort(s);B.s=newTreeSet(s);C.Collections.sort(s);D.s=newSortedSet(s);

单项选择题 Given:int[]myArray=newint[]{1,2,3,4,5};Whatallowsyoutocreatealistfromthisarray?()

单项选择题 importjava.util.*;publicclassLetterASort{publicstaticvoidmain(String[]args){ArrayListstrings=newArrayList();strings.add(?aAaA”);strings.add(”AaA”);strings.add(?aAa”);strings.add(”AAaa”);Collections.sort(strings);for(Strings:strings){System.out.print(s+);}}}Whatistheresult?()A.Compilationfails.B.aAaAaAaAAaaAaAC.AAaaAaAaAaaAaAD.AaAAAaaaAaAaAaE.aAaAaAaAaAAAaaF.Anexceptionisthrownatruntime.

单项选择题 publicstaticvoidsearch(Listlist){list.clear();list.add(”b”);list.add(”a”);list.add(”c”);System.out.println(Collections.binarySearch(list,a”));}WhatistheresultofcallingsearchwithavalidListimplementation?()A.0B.1C.aD.bE.cF.Theresultisundefined.

单项选择题 Givenacorrectlycompiledclasswhosesourcecodeis:packagecom.sun.sjcp;publicclassCommander{publicstaticvoidmain(String[]args){//morecodehere}}Assumethattheclassfileislocatedin/foo/com/sun/sjcp/,thecurrentdirectoryis/foo/,andthattheclasspathcontains.(currentdirectory).WhichcommandlinecorrectlyrunsCommander?()A.javaCommanderB.javacom.sim.sjcp.CommanderC.javacom/sun/sjcp/CommanderD.java-cpcom.sun.sjcpCommanderE.java-cpcom/sun/sjcpCommander

单项选择题 1.interfaceDoStuff2{2.floatgetRange(intlow,inthigh);}3.4.interfaceDoMore{5.floatgetAvg(inta,intb,intc);}6.7.abstractclassDoAbstractimplementsDoStuff2,DoMore{}8.9.classDoStuffimplementsDoStuff2{10.publicfloatgetRange(intx,inty){return3.14f;}}11.12.interfaceDoAllextendsDoMore{13.floatgetAvg(inta,intb,intc,intd);}Whatistheresult?()A.Thefilewillcompilewithouterror.B.Compilationfails.Onlyline7containsanerror.C.Compilationfails.Onlyline12containsanerror.D.Compilationfails.Onlyline13containsanerror.E.Compilationfails.Onlylines7and12containerrors.F.Compilationfails.Onlylines7and13containerrors.G.Compilationfails.Lines7,12,and13containerrors.

单项选择题 interfaceDeclareStuff{publicstaticfinalintEASY=3;voiddoStuff(intt);}publicclassTestDeclareimplementsDeclareStuff{publicstaticvoidmain(String[]args){intx=5;newTestDeclare().doStuff(++x);}voiddoStuff(ints){s+=EASY+++s;System.out.println(”s+s);}}Whatistheresult?()A.s14B.s16C.s10D.Compilationfails.E.Anexceptionisthrownatruntime.

单项选择题 publicclassPerson{2.privateStringname;3.publicPerson(Stringname){this.name=name;}4.publicbooleanequals(Personp){5.returnp.name.equals(this.name);6.}7.}Whichistrue?()

单项选择题 publicclassPerson{privateStringname,comment;privateintage;publicPerson(Stringn,inta,Stringc){name=n;age=a;comment=c;}publicbooleanequals(Objecto){if(!(oinstanceofPerson))returnfalse;Personp=(Person)o;returnage==p.age&&name.equals(p.name);}}WhatistheappropriatedefinitionofthehashCodemethodinclassPerson?()A.returnsuper.hashCode();B.returnname.hashCode()+age*7;C.returnname.hashCode()+comment.hashCode()/2;D.returnname.hashCode()+comment.hashCode()/2-age*3;

单项选择题 Listlist=//morecodehere12.Collections.sort(list,newMyComparator());Whichcodewillsortthislistintheoppositeorderofthesortinline12?()

单项选择题 publicclassDrinkimplementsComparable{publicStringname;publicintcompareTo(Objecto){return0;}}and:Drinkone=newDrink();Drinktwo=newDrink();one.name=Coffee”;two.name=Tea”;TreeSetset=newTreeSet();set.add(one);set.add(two);AprogrammeriteratesovertheTreeSetandprintsthenameofeachDrinkobject.Whatistheresult?()A.TeaB.CoffeeC.CoffeeTeaD.Compilationfails.E.Thecoderunswithnooutput.F.Anexceptionisthrownatruntime.

单项选择题 importjava.util.*;classKeyMaster{publicinti;publicKeyMaster(inti){this.i=i;}publicbooleanequals(Objecto){returni==((KeyMaster)o).i;}publicinthashCode(){returni;}}publicclassMapIt{publicstaticvoidmain(String[]args){Setset=newHashSet();KeyMasterk1=newKeyMaster(1);KeyMasterk2=newKeyMaster(2);set.add(k1);set.add(k1);set.add(k2);set.add(k2);System.out.print(set.size()+:”);k2.i=1;System.out.print(set.size()+:”);set.remove(k1);System.out.print(set.size()+:”);set.remove(k2);System.out.print(set.size());}}Whatistheresult?()

单项选择题 通过机器手到各个网站搜集、存储信息,并建立索引数据库供用户查询的搜索引擎叫()。

单项选择题 邮件地址“gltdaozhi@buu.edu.cn”的用户名是()。

单项选择题 publicclassClassA{publicintgetValue(){intvalue=0;booleansetting=true;Stringtitle=”Hello”;(value||(setting&&title==Hello”)){return1;}(value==1&title.equals(”Hello”)){return2;}}}And:ClassAa=newClassA();a.getValue();Whatistheresult?()A.1B.2C.Compilationfails.D.Thecoderunswithnooutput.E.Anexceptionisthrownatruntime.

单项选择题 ()是指调整文本与页面边界之间的距离。

单项选择题 覆盖范围从几十千米到成百上千甚至上万千米,传输速率较低的计算机网络是()。

单项选择题 HTML是使用超文本()语言编写的。