版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Java期末专项测试卷单选题(总共40题)1.单选题Analyzethefollowingcode:()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Int[]x={1,2,3,4};
Int[]y=x;
X=newint[2];
For(inti=0;i<y.length;i++)
System.out.print(y[i]+"");
}
}(1分)A、Theprogramdisplays1234B、Theprogramdisplays00C、Theprogramdisplays0034D、Theprogramdisplays0000答案:A解析:
暂无解析2.单选题Whatistheoutputofthefollowingcode?()
ArrayList<String>list=newArrayList<String>();
Strings1=newString("Java");
Strings2=newString("Java");
List.add(s1);
List.add(s2);
System.out.println((list.get(0)==list.get(1))+""+(list.get(0)).equals(list.get(1)));(1分)A、truefalseB、falsetrueC、truetrueD、falsefalse答案:B解析:
暂无解析3.单选题Thefollowingprogramdisplays__________.()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Strings="Java";
StringBuilderbuffer=newStringBuilder(s);
Change(s);
System.out.println(s);
}
Privatestaticvoidchange(Strings){
S=s+"andHTML";
}
}(1分)A、JavaB、JavaandHTMLC、andHTMLD、nothingisdisplayed答案:A解析:
暂无解析4.单选题Whichofthefollowingcanbeplacedintheblanklineinthefollowingcode?()
PublicclassTest{
Privateintid;
Publicvoidm1(){
_____.id=45;
}
}(1分)A、thisB、Test答案:A解析:
暂无解析5.单选题Analyzethefollowingcode:()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Strings=newString("WelcometoJava");
Objecto=s;
Stringd=(String)o;
}
}(1分)A、WhenassigningstooinObjecto=s,anewobjectiscreated.B、WhencastingotosinStringd=(String)o,anewobjectiscreated.C、WhencastingotosinStringd=(String)o,thecontentsofoischanged.D、s,o,anddreferencethesameStringobject.答案:C解析:
暂无解析6.单选题Assumeanemployeecanworkforonlyonecompany.WhatisthebestsuitablerelationshipbetweenCompanyandEmployee?()(1分)A、NoneB、AggregationC、InheritanceD、Composition答案:D解析:
暂无解析7.单选题Whichistheadvantageofencapsulation?()(1分)A、Onlypublicmethodsareneeded.B、Makingtheclassfinalcausesnoconsequentialchangestoothercode.C、Itchangestheimplementationwithoutchangingaclass'scontractandcausesnoconsequentialchangestoothercode.D、Itchangesaclass'scontractwithoutchangingtheimplementationandcausesnoconsequentialchangestoothercode.答案:C解析:
暂无解析8.单选题Thetimecomplexityforthetheclosestpairofpointsproblemusingdivide-and-conqueris________.()(1分)A、O(n)B、O(nlogn)C、O(logn)D、O(2^n)答案:B解析:
暂无解析9.单选题Analyzethefollowingcodeandchoosethebestanswer:()
PublicclassFoo{
Privateintx;
Publicstaticvoidmain(String[]args){
Foofoo=newFoo();
System.out.println(foo.x);
}
}(1分)A、Sincexisprivate,itcannotbeaccessedfromanobjectfoo.B、
SincexisdefinedintheclassFoo,itcanbeaccessedbyanymethodinsidetheclasswithoutusinganobject.Youcanwritethecodetoaccessxwithoutcreatinganobjectsuchasfoointhiscode.C、
Sincexisaninstancevariable,itcannotbedirectlyusedinsideamainmethod.However,itcanbeaccessedthroughanobjectsuchasfoointhiscode.D、Youcannotcreateaself-referencedobject;thatis,fooiscreatedinsidetheclassFoo.答案:C解析:
暂无解析10.单选题Amethodthatisassociatedwithanindividualobjectiscalled__________.()(1分)A、astaticmethodB、aclassmethodC、aninstancemethodD、anobjectmethod答案:C解析:
暂无解析11.单选题Analyzethefollowingcode.()
Importjava.util.*;
PublicclassTest{
Publicstaticvoidmain(String[]args)throwsException{
TreeSet<String>set=newTreeSet<>();
Set.add("Red");
Set.add("Green");
Set.add("Blue");
System.out.println(set.last());
}
}(1分)A、TheprogramdisplaysRedB、TheprogramdisplaysBlueC、TheprogramdisplaysGreenD、TheprogrammaydisplayRed,Blue,orGreen.E、Theprogramcannotcompile,becausethelast()methodisnotdefinedinSet.答案:A解析:
暂无解析12.单选题Thejava.util.Calendarandjava.util.GregorianCalendarclassesareintroducedinChapter11.Analyzethefollowingcode.Whichofthefollowingstatementsiscorrect?()
1importjava.util.*;
2publicclassTest{
3publicstaticvoidmain(String[]args){
4Calendar[]calendars=newCalendar[10];
5calendars[0]=newCalendar();
6calendars[1]=newGregorianCalendar();
7}
8}(1分)A、TheprogramhasacompileerroronLine4becausejava.util.Calendarisanabstractclass.B、TheprogramhasacompileerroronLine5becausejava.util.Calendarisanabstractclass.C、TheprogramhasacompileerroronLine6becauseCalendar[1]isnotofaGregorianCalendartype.D、Theprogramhasnocompileerrors答案:B解析:
暂无解析13.单选题ThetimecomplexityfortherecursiveFibnaccialgorithminthetextis________.()(1分)A、O(nlogn)B、O(n^2)C、O(logn)D、O(2^n)答案:D解析:
暂无解析14.单选题Thejava.util.Calendarandjava.util.GregorianCalendarclassesareintroducedinChapter11.Analyzethefollowingcode.Whichofthefollowingstatementsiscorrect?()
1importjava.util.*;
2publicclassTest{
3publicstaticvoidmain(String[]args){
4Calendar[]calendars=newCalendar[10];
5calendars[0]=newCalendar();
6calendars[1]=newGregorianCalendar();
7}
8}(1分)A、TheprogramhasacompileerroronLine4becausejava.util.Calendarisanabstractclass.B、TheprogramhasacompileerroronLine5becausejava.util.Calendarisanabstractclass.C、TheprogramhasacompileerroronLine6becauseCalendar[1]isnotofaGregorianCalendartype.D、Theprogramhasnocompileerrors答案:B解析:
暂无解析15.单选题Analyzethefollowingcode.Whichofthefollowingstatementsiscorrect?()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Numberx=newInteger(3);
System.out.println(Value());
System.out.println(pareTo(newInteger(4)));
}
}(1分)A、TheprogramhasacompileerrorbecauseanIntegerinstancecannotbeassignedtoaNumbervariable.B、TheprogramhasacompileerrorbecauseintValueisanabstractmethodinNumber.C、TheprogramhasacompileerrorbecausexdoesnothavethecompareTomethod.D、Theprogramcompilesandrunsfine.答案:C解析:
暂无解析16.单选题Analyzethefollowingcode:()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Doubleradius;
FinaldoublePI=3.15169;
Doublearea=radius*radius*PI;
System.out.println("Areais"+area);
}
}(1分)A、Theprogramhascompileerrorsbecausethevariableradiusisnotinitialized.B、TheprogramhasacompileerrorbecauseaconstantPIisdefinedinsideamethod.C、Theprogramhasnocompileerrorsbutwillgetaruntimeerrorbecauseradiusisnotinitialized.D、Theprogramcompilesandrunsfine.答案:A解析:
暂无解析17.单选题Whenyoupassanarraytoamethod,themethodreceives__________.()(1分)A、acopyofthearrayB、acopyofthefirstelementC、thereferenceofthearrayD、thelengthofthearray答案:C解析:
暂无解析18.单选题Supposelist1isanArrayListandlist2isaLinkedList.Bothcontains1milliondoublevalues.Analyzethefollowingcode:()
A-
For(inti=0;i<list1.size();i++)
Sum+=list1.get(i);
B-
For(inti=0;i<list2.size();i++)
Sum+=list2.get(i);(1分)A、CodefragmentArunsfasterthancodefragmentBB、CodefragmentBrunsfasterthancodefragmentAC、CodefragmentArunsasfastascodefragmentB答案:A解析:
暂无解析19.单选题Analyzethefollowingcode.()
//Program1:
PublicclassTest{
Publicstaticvoidmain(String[]args){
Objecta1=newA();
Objecta2=newA();
System.out.println(a1.equals(a2));
}
}
ClassA{
Intx;
Publicbooleanequals(Aa){
Returnthis.x==a点x;
}
}
//Program2:
PublicclassTest{
Publicstaticvoidmain(String[]args){
Aa1=newA();
Aa2=newA();
System.out.println(a1.equals(a2));
}
}
ClassA{
Intx;
Publicbooleanequals(Aa){
Returnthis.x==a.x;
}
}(1分)A、Program1displaystrueandProgram2displaystrueB、Program1displaysfalseandProgram2displaystrueC、Program1displaystrueandProgram2displaysfalseD、Program1displaysfalseandProgram2displaysfalse答案:B解析:
暂无解析20.单选题Whatistheoutputofthefollowingcode?()
Int[]myList={1,2,3,4,5,6};
For(inti=myList.length-2;i>=0;i--){
MyList[i+1]=myList[i];
}
For(inte:myList)
System.out.print(e+"");(1分)A、123456B、612345C、623451D、112345E、234561答案:D解析:
暂无解析21.单选题Analyzethefollowingcode:()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Int[]x={1,2,3,4,5};
XMethod(x,5);
}
PublicstaticvoidxMethod(int[]x,intlength){
System.out.print(""+x[length-1]);
XMethod(x,length-1);
}
}(1分)A、Theprogramdisplays12346.B、Theprogramdisplays12345andthenraisesanArrayIndexOutOfBoundsException.C、Theprogramdisplays54321.D、Theprogramdisplays54321andthenraisesanArrayIndexOutOfBoundsException.答案:D解析:
暂无解析22.单选题AssumeStringBuilderstrBufis"ABCDEFG",afterinvoking_________,strBufcontains"AEFG".()(1分)A、strBuf.delete(0,3)B、strBuf.delete(1,3)C、strBuf.delete(1,4)D、strBuf.delete(2,4)答案:C解析:
暂无解析23.单选题Youcandeclaretwovariableswiththesamenamein__________.()(1分)A、amethodoneasaformalparameterandtheotherasalocalvariableB、ablockC、twonestedblocksinamethod(twonestedblocksmeansonebeinginsidetheother)D、differentmethodsinaclass答案:D解析:
暂无解析24.单选题Whatistheoutputforthefollowingcode?()
Importjava.util.*;
PublicclassTest{
Publicstaticvoidmain(String[]args){
Set<A>set=newHashSet<>();
Set.add(newA());
Set.add(newA());
Set.add(newA());
Set.add(newA());
System.out.println(set);
}
}
ClassA{
Intr=1;
PublicStringtoString(){
Returnr+"";
}
PublicinthashCode(){
Returnr;
}
}(1分)A、[1]B、[1,1]C、[1,1,1]D、[1,1,1,1]答案:D解析:
暂无解析25.单选题SupposeArrayListxcontainstwostrings[Beijing,Singapore].Whichofthefollowingmethodswillcausethelisttobecome[Beijing,Chicago,Singapore]?()(1分)A、x.add("Chicago")B、x.add(0,"Chicago")C、x.add(1,"Chicago")D、x.add(2,"Chicago")答案:C解析:
暂无解析26.单选题O(1)is________.()(1分)A、constanttimeB、logarithmictimeC、lineartimeD、log-lineartime答案:A解析:
暂无解析27.单选题Theaverage-timecomplexityforheapsortis_________()(1分)A、O(1)B、O(logn)C、O(n)D、O(nlogn)E、O(n*n)答案:D解析:
暂无解析28.单选题Ifyoudeclareanarraydouble[]list={3.4,2.0,3.5,5.5},thehighestindexinarraylistis__________.()(1分)A、0B、1C、2D、3E、4答案:D解析:
暂无解析29.单选题IsArrayList<Number>asubclassofArrayList<?extendsNumber>?()(1分)A、YesB、No答案:A解析:
暂无解析30.单选题Whatisdisplayedbythefollowingcode?()
String[]tokens="A,B;C;D".split("[,;]");
For(inti=0;i<tokens.length;i++)
System.out.print(tokens[i]+"");(1分)A、AB;C;DB、ABCDC、ABC;DD、AB;C;D答案:B解析:
暂无解析31.单选题Supposesets1is[1,2,5]andsets2is[2,3,6].Afters1.removeAll(s2),s1is__________.()(1分)A、[1,2,2,3,5,6]B、[1,2,3,5,6]C、[1,5]D、[2]答案:C解析:
暂无解析32.单选题WhatistheoutputofrunningclassC?()
ClassA{
PublicA(){
System.out.println(
"ThedefaultconstructorofAisinvoked");
}
}
ClassBextendsA{
PublicB(){
System.out.println(
"ThedefaultconstructorofBisinvoked");
}
}
PublicclassC{
Publicstaticvoidmain(String[]args){
Bb=newB();
}
}(1分)A、NothingdisplayedB、"ThedefaultconstructorofBisinvoked"C、"ThedefaultconstructorofAisinvoked"followedby"ThedefaultconstructorofBisinvoked"D、"ThedefaultconstructorofBisinvoked"followedby"ThedefaultconstructorofAisinvoked"E、"ThedefaultconstructorofAisinvoked"答案:C解析:
暂无解析33.TodeclareaninterfacenamedAwithtwogenerictypes,use(1分)A、publicinterfaceA<E>{...}B、publicinterfaceA<E,F>{...}C、publicinterfaceA(E){...}D、publicinterfaceA(E,F){...}答案:B解析:
暂无解析34.单选题The__________algorithmdoesnotcomparekeys.()(1分)A、quicksortB、mergesortC、heapsortD、radixsort答案:D解析:
暂无解析35.单选题AlltheconcreteclassesintheJavaCollectionsFrameworkimplement_____________.()(1分)A、theCloneableinterfaceB、theSerializableinterfacesC、theComparableinterfaceD、theComparatorinterface答案:B解析:
暂无解析36.单选题Youcanuseafor-eachlooptotraverseallelementsinacontainerobjectthatimplements_____.()(1分)A、IteratorB、CollectionC、IterableD、ArrayList答案:C解析:
暂无解析37.单选题Whatistheoutputofthefollowingcode?()
PublicclassTest{
Publicstaticvoidmain(String[]args){
Strings1="WelcometoJava!";
Strings2="WelcometoJava!";
If(s1==s2)
System.out.println("s1ands2referencetothesameStringobject");
Else
System.out.println("s1ands2referencetodifferentStringobjects");
}
}(1分)A、s1ands2referencetothesameStringobjectB、s1ands2referencetodifferentStringobjects答案:A解析:
暂无解析38.单选题Aninputthatresultsintheshortestexecutiontimeiscalledthe_____________.()(1分)A、best-caseinputB、worst-caseinputC、average-caseinput答案:A解析:
暂无解析39.单选题Thekeyword__________isrequiredtodeclareaclass.()(1分)A、publicB、privateC、classD、Alloftheabove.答案:C解析:
暂无解析40.单选题TocreateagenerictypeboundedbyNumber,use()(1分)A、<EextendsNumber>B、<EextendsObject>C、<E>D、<EextendsInteger>答案:A解析:
暂无解析多选题(总共40题)1.多选题__________returnsastring.()(1分)A、String.valueOf(123)B、String.valueOf(12.53)C、String.valueOf(false)D、String.valueOf(newchar[]{'a','b','c'})答案:ABCD解析:
暂无解析2.多选题WhichofthefollowingcanbeusedtoreplaceYYYYYYYYinthefollowingcode?()
PublicclassWildCardDemo3{
Publicstaticvoidmain(String[]args){
GenericStack<String>stack1=newGenericStack<>();
GenericStack<Object>stack2=newGenericStack<>();
Stack2.push("Java");
Stack2.push(2);
Stack1.push("Sun");
Add(stack1,stack2);
WildCardDemo2.print(stack2);
}
Publicstatic<T>voidYYYYYYYY{
While(!stack1.isEmpty())
Stack2.push(stack1.pop());
}
}(1分)A、add(GenericStack<T>stack1,GenericStack<T>stack2)B、add(GenericStack<?extendsT>stack1,GenericStack<T>stack2)C、add(GenericStack<T>stack1,GenericStack<?superT>stack2)D、add(GenericStack<T>stack1,GenericStack<Object>stack2)答案:BC解析:
暂无解析3.多选题Whichofthefollowingstatementsaretrue?()(1分)A、Asubclassisasubsetofasuperclass.B、Asubclassisusuallyextendedtocontainmorefunctionsandmoredetailedinformationthanitssuperclass.C、"classAextendsB"meansAisasubclassofBD、"classAextendsB"meansBisasubclassofA答案:BC解析:
暂无解析4.多选题Thejava.util.Dateclassisintroducedinthissection.Analyzethefollowingcodeandchoosethebestanswer:WhichofthefollowingcodeinIorII,orbothcreatesanobjectoftheDateclass:()
(I)
PublicclassTest{
PublicTest(){
Newjava.util.Date();
}
}
(II)
PublicclassTest{
PublicTest(){
Java.util.Datedate=newjava.util.Date();
}
}(1分)A、IB、IIC、Neither答案:AB解析:
暂无解析5.多选题YoucanusethemethodsintheArraysclassto()(1分)A、findthemaximumobjectinanarraybasedonthecompareTomethod.B、findthemaximumobjectinanarrayusingaComparatorobject.C、sortanarray.D、shuffleanarray.E、doabinarysearchonanarray.答案:CE解析:
暂无解析6.多选题Whichofthefollowingstatementsiscorrect?()(1分)A、Integer.parseInt("12",2);B、Integer.parseInt(100);C、Integer.parseInt("100");D、Integer.parseInt(100,16);E、Integer.parseInt("345",8);答案:CE解析:
暂无解析7.多选题SupposeArrayList<Double>list=newArrayList<>().Whichofthefollowingstatementsarecorrect?()(1分)A、list.add(5.5);//5.5isautomaticallyconvertedtonewDouble(5.5)B、list.add(3.0);//3.0isautomaticallyconvertedtonewDouble(3.0)C、DoubledoubleObject=list.get(0);//NocastingisneededD、doubled=list.get(1);//Automaticallyconvertedtodouble答案:ABCD解析:
暂无解析8.多选题FillinthecodetocompletethefollowingmethodforcomputingaFibonaccinumber.()
Publicstaticlongfib(longindex){
If(index==0)//Basecase
Return0;
Elseif(index==1)//Basecase
Return1;
Else//Reductionandrecursivecalls
Return__________________;
}(1分)A、fib(index-1)B、fib(index-2)C、fib(index-1)+fib(index-2)D、fib(index-2)+fib(index-1)答案:CD解析:
暂无解析9.多选题Whichofthefollowingstatementsiscorrect?()(1分)A、Comparable<String>c=newString("abc");B、Comparable<String>c="abc";C、Comparable<String>c=newDate();D、Comparable<Object>c=newDate();答案:AB解析:
暂无解析10.多选题SupposeArrayListxcontainstwostrings[Beijing,Singapore].Whichofthefollowingmethodwillcausethelisttobecome[Beijing]?()(1分)A、x.remove("Singapore")B、x.remove(0)C、x.remove(1)D、x.remove(2)答案:AC解析:
暂无解析11.Whichofthefollowingstatementsregardingabstractmethodsistrue?()(1分)A、Abstractclasseshaveconstructors.B、Aclassthatcontainsabstractmethodsmustbeabstract.C、Itispossibletodeclareanabstractclassthatcontainsnoabstractmethods.D、Anabstractmethodcannotbecontainedinanonabstractclass.E、Adatafieldcanbedeclaredabstract.答案:ABCD解析:
暂无解析12.多选题Supposes1ands2aretwostrings.Whichofthefollowingstatementsorexpressionsareincorrect?()(1分)A、Strings=newString("newstring");B、Strings3=s1+s2C、s1>=s2D、inti=s1.lengthE、s1.charAt(0)='5'答案:CDE解析:
暂无解析13.多选题Whichofthefollowingstatementsarecorrect?()(1分)A、WhencreatingaRandomobject,youhavetospecifytheseedorusethedefaultseed.B、IftwoRandomobjectshavethesameseed,thesequenceoftherandomnumbersobtainedfromthesetwoobjectsareidentical.C、ThenextInt()methodintheRandomclassreturnsthenextrandomintvalue.D、ThenextDouble()methodintheRandomclassreturnsthenextrandomdoublevalue.答案:ABCD解析:
暂无解析14.多选题Whichofthefollowingstatementsiscorrect?()(1分)A、Integeri=4.5;B、Doublei=4.5;C、Objecti=4.5;D、Numberi=4.5;答案:BCD解析:
暂无解析15.多选题Whichofthefollowingarevalidspecifiersfortheprintfstatement?()(1分)A、%4cB、%10bC、%6dD、%8.2dE、%10.2e答案:ABCE解析:
暂无解析16.多选题InJDK1.5,analyzethefollowingcode.()
Line1:Integer[]intArray={1,2,3};
Line2:inti=intArray[0]+intArray[1];
Line3:intj=i+intArray[2];
Line4:doubled=intArray[0];(1分)A、ItisOKtoassign1,2,3toanarrayofIntegerobjectsinJDK1.5.B、ItisOKtoautomaticallyconvertanIntegerobjecttoanintvalueinLine2.C、ItisOKtomixanintvaluewithanIntegerobjectinanexpressioninLine3.D、Line4isOK.AnintvaluefromintArray[0]objectisassignedtoadoublevariabled点答案:ABCD解析:
暂无解析17.多选题WhichofthefollowingisapossibleoutputfrominvokingMath.random()?()(1分)A、3.43B、0.5C、0.0D、1.0答案:BC解析:
暂无解析18.多选题Whichofthefollowingmethodsareinjava.util.List?()(1分)A、add(intindex,Eelement)B、get(intindex)C、set(intindex,Eelement)D、remove(intindex)E、subList(intfromIndex,inttoIndex)答案:ABCDE解析:
暂无解析19.多选题Analyzethefollowingcode:()
ClassTest{
Privatedoublei;
PublicTest(doublei){
This.t();
This.i=i;
}
PublicTest(){
System.out.println("Defaultconstructor");
This(1);
}
Publicvoidt(){
System.out.println("Invokingt");
}
}(1分)A、this.t()maybereplacedbyt().B、this.imaybereplacedbyi.C、this(1)mustbecalledbeforeSystem.out.println("Defaultconstructor").D、this(1)mustbereplacedbythis(1.0).答案:AC解析:
暂无解析20.多选题Supposeinti=5,whichofthefollowingcanbeusedasanindexforarraydouble[]t=newdouble[100]?()(1分)A、iB、(int)(Math.random()*100))C、i+10D、i+6.5E、Math.random()*100答案:ABC解析:
暂无解析21.多选题Whichofthefollowingstatementsaretrue?()(1分)A、Aheapisacompletebinarytree.B、Eachnodeisgreaterthanorequaltoanyofitschildren.C、Abinarytreeiscompleteifeverylevelofthetreeisfullexceptthatthelastlevelmaynotbefullandalltheleavesonthelastlevelareplacedleft-most.D、Aheapisafullbinarytree.答案:ABC解析:
暂无解析22.多选题WhichofthefollowingcanbeusedtoreplaceYYYYYYYYinthefollowingcode?()
PublicclassWildCardDemo3{
Publicstaticvoidmain(String[]args){
GenericStack<String>stack1=newGenericStack<>();
GenericStack<Object>stack2=newGenericStack<>();
Stack2.push("Java");
Stack2.push(2);
Stack1.push("Sun");
Add(stack1,stack2);
WildCardDemo2.print(stack2);
}
Publicstatic<T>voidYYYYYYYY{
While(!stack1.isEmpty())
Stack2.push(stack1.pop());
}
}(1分)A、add(GenericStack<T>stack1,GenericStack<T>stack2)B、add(GenericStack<?extendsT>stack1,GenericStack<T>stack2)C、add(GenericStack<T>stack1,GenericStack<?superT>stack2)D、add(GenericStack<T>stack1,GenericStack<Object>stack2)答案:BC解析:
暂无解析23.WhichofthefollowingmethodsareintheCollectioninterface?(1分)A、add(o:E)B、addAll(c:Collection<?extendsE>)C、contains(o:Object):booleanD、containsAll(c:Collection<?>):boolean答案:ABCD解析:
暂无解析24.多选题Whichofthefollowingareincorrect?()(1分)A、Anabstractclasscontainsconstructors.B、Theconstructorsinanabstractclassshouldbeprotected.C、Theconstructorsinanabstractclassareprivate.D、Youmaydeclareafinalabstractclass.E、Aninterfacemaycontainconstructors.答案:CDE解析:
暂无解析25.多选题WhatisthepossibleoutputfromSystem.out.println((int)(Math.random()*4))?()(1分)A、0B、1C、2D、3E、4答案:ABCD解析:
暂无解析26.多选题Whatiscorrectaboutapivot?()(1分)A、Apivotdividesalistintotwosublistsofequalsize.B、Apivotcanbechosenarbitrarily.C、Apivotdividesalistintotwosublists,theelementsinthefirstlistarenolargerthanthepivotandtheelementsinthesecondlistarelargerthanthepivot.D、Youshouldalwayschooseapivotthatdividesthelistevenly.答案:BC解析:
暂无解析27.多选题Giventhefollowingcode,findthecompileerror.()
PublicclassTest{
Publicstaticvoidmain(String[]args){
M(newGraduateStudent());
M(newStudent());
M(newPerson());
M(newObject());
}
Publicstaticvoidm(Studentx){
System.out.println(x.toString());
}
}
ClassGraduateStudentextendsStudent{
}
ClassStudentextendsPerson{
@Override
PublicStringtoString(){
Return"Student";
}
}
ClassPersonextendsObject{
@Override
PublicStringtoString(){
Return"Person";
}
}(1分)A、m(newGraduateStudent())causesanerrorB、m(newStudent())causesanerrorC、m(newPerson())causesanerrorD、m(newObject())causesanerror答案:CD解析:
暂无解析28.多选题SupposeArrayList<Double>list=newArrayList<>().Whichofthefollowingstatementsarecorrect?()(1分)A、list.add(5.5);//5.5isautomaticallyconvertedtonewDouble(5.5)B、list.add(3.0);//3.0isautomaticallyconvertedtonewDouble(3.0)C、DoubledoubleObject=list.get(0);//NocastingisneededD、doubled=list.get(1);//Automaticallyconvertedtodouble答案:ABCD解析:
暂无解析29.多选题Whichofthefollowingispoordesign?()(1分)A、Adatafieldisderivedfromotherdatafieldsinthesameclass.B、Amethodmustbeinvokedafter/beforeinvokinganothermethodinthesameclass.C、Amethodisaninstancemethod,butitdoesnotreferenceanyinstancedatafieldsorinvokeinstancemethods
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 个人机动车抵押借款合同2024样式版B版
- 2025年度新能源车辆设备租赁服务合同范本4篇
- 二零二五版新能源电站安全生产运营服务合同3篇
- 二零二五年度文化演出担保期限与票务销售协议4篇
- 二零二五年阿里巴巴电商店铺全面托管与运营合同范本3篇
- 2025年度园林景观树木养护管理合同协议4篇
- 科技企业中的精细化饲料管理模式构建
- 2025版美食广场食品安全责任书4篇
- 2025年度磁性材料环保认证与采购合同3篇
- 二零二五版拆房工程噪音污染防治合同3篇
- (二统)大理州2025届高中毕业生第二次复习统一检测 物理试卷(含答案)
- 口腔执业医师定期考核试题(资料)带答案
- 2024人教版高中英语语境记单词【语境记单词】新人教版 选择性必修第2册
- 能源管理总结报告
- 充电桩巡查记录表
- 阻燃材料的阻燃机理建模
- CJT 511-2017 铸铁检查井盖
- 配电工作组配电网集中型馈线自动化技术规范编制说明
- 2024高考物理全国乙卷押题含解析
- 介入科围手术期护理
- 青光眼术后护理课件
评论
0/150
提交评论