您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 招聘面试 > 09级Java技术试题
1/5西安电子科技大学考试时间120分钟试题题号III总分分数1.考试形式:闭卷;2.考试日期:年月日3.本试卷共2大题,满分100分。班级学号姓名任课教师Note:Writeallanswersontheanswersheet.QuestionI:Multiplechoices(2*20=40points)1.WhichJDKcommandiscorrecttorunaJavaapplicationinmyProgram.java?A.javamyProgramB.javamyProgram.classC.javacmyProgram.javaD.javacmyProgram2.Whichofthefollowingdefinitionsdefinesalegalinterface?A.interfaceA{abstractvoidunfinished(){}}B.interfaceA{abstractvoidunfinished();}C.interfaceA{voidunfinished();}D.publicinterfaceA{abstractvoidunfinished();}3.Whichofthefollowingstatementsarefalse?A.AclasscanonlyextendoneclassB.AclasscanimplementmorethanoneinterfaceC.AninterfacecannotextendotherinterfacesD.Aninterfacecanextendmorethanoneinterface4.Whichofthefollowingkeywordsnotbelongtothejavakeywords?A.constB.sizeofC.assertD.volatile5.SupposeAisanabstractclass,BisaconcretesubclassofA,andbothAandBhaveadefaultconstructor.Whichofthefollowingisnotcorrect?A.Aa=newA();B.Aa=newB();C.Bb=newB();D.BandCarecorrect2/56.Analyzethefollowingcode,theresultis:publicclassTest{publicstaticvoidmain(String[]args){Bb=newB();b.m(5);b.m(23.0);System.out.println(dis+b.d);}}classA{protectedinti;publicvoidm(inti){this.i=i;}}classBextendsA{doubled;publicvoidm(doubled){this.d+=d+i;}}A.dis28.0.B.run-timeerror.C.compileerror.D.dis23.0.7.Whatwillthefollowingprogramdisplaywhenyouattempttocompileandrunit?publicclassTest{//#1publicstaticvoidmain(String[]args){Objecta1=newA();Objecta2=newA();Aa3=newA();Aa3=newA();Strings1=”Hello!”;Strings2=”Hello!”;System.out.println(a1.equals(a2));System.out.println(a3.equals(a4));System.out.println(s1.equals(s2));}}classA{intx;publicbooleanequals(Aa){returnthis.x==a.x;}}A.B.C.D.truetruefalsefalsefalsetruetruetruetruefalsefalsetrue3/58.Whichoneofthefollowingstatementsisnotcorrect?A.inta[20];B.inta[]={1,2,3,4,5};C.int[][]a;D.inta[][];a=newint[2][];a=newint[2][3];a[0]=newint[2];a[1]=newint[3];9.IfstrisavariablewithString[]type,whichoneoffollowingcangetitslength?A.str.length()B.str.lengthC.str.size()D.str.size10.SupposeyouhaveclassesVehicle,Engine,WheelandWindow,andyouwanttobuildaCar,whichofthefollowingconceptsisbestsuitableforit?A.InheritanceB.InheritancewithExtensionC.CompositionD.CompositionandInheritance11.Whichofthefollowingstatementsisnotcorrect?A.Collectionc=newTreeSet();B.Collectionc=newLinkedList();C.Collectionc=newStack();D.Collectionc=newHashMap();12.ConstructaninstanceofclassArrayListEwhichimplementationoftheListEinterfacewhichinheritstheCollectionEinterface.WhichofthefollowingstatementsistruewhereEisString?A.ArrayListStringmyCollection=newString();B.CollectionStringmyCollection=newArrayListString();C.ArrayListStringmyCollection=newCollectionString();D.CollectionStringmyCollection=newCollectionString();13.WhichofthefollowingstatementscreatesaninstanceofDirectoryonWindowfortheDirectoryD:\Myfile?A.newFile(D:\Myfile)B.newFile(D:\\Myfile)C.newFile(D:/Myfile)D.newFile(D://Myfile)14.WhichofthefollowingexpressionsmustbetrueifyoucreateathreadusingThreadobject=newThread()?A.objectinstanceofJFrameB.objectinstanceofFrameC.objectinstanceofAppletD.objectinstanceofRunnable15.Inwhichclass/collectionisthewait()methoddefined?A.AppletB.RunnableC.ThreadD.Object16.Whichofthekeywordscanmakesanobjectofaclassserializable?A.transientB.privateC.staticD.serializable4/517.Analyzingthefollowingcode,whichoffollowingstatementsshouldreplace//answergoeshereimportjavax.swing.*;publicclassDisplayextendsJFrame{publicDisplay(){super(Display);//answergoeshereJLabelhello=newJLabel(Hello);JPanelpane=newJPanel();pane.add(hello);setContentPane(pane);pack();setVisible(true);}publicstaticvoidmain(String[]args){Displayds=newDisplay();}}A.setSize(300,200);B.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);C.Displayds=newDisplay();D.nostatement18.Whichisthefollowingprogramresult?publicclassA{publicstaticvoidmain(String[]args){Strings=if(a==3)a=0;n;charbuf[]=newchar[s.length()];s.getChars(0,s.length(),buf,0);CharArrayReaderin=newCharArrayReader(buf);PushbackReaderf=newPushbackReader(in);intc;try{while((char)(c=f.read())!=-1){switch(c){case'=':if((c=f.read())=='=')System.out.print(.eq.);else{System.out.print(-);f.unread(c);}break;default:System.out.print((char)c);break;}}5/5}catch(IOExceptione){System.out.print(error!);}}}A.if(a--4)a.eq.0B.if(a.eq.4)a.eq.0C.if(a.eq.4)a-0D.if(a--4)a-019.Whenanobjectofathreadinvokesleepmethod,whichstatewillthethreadobjectenterinto?A.newB.blockC.runnableD.destroy20.whichisthefollowingprogramresult?publicclassDemo{publicstaticvoidmain(String[]args){SuperClasss=newSuperClass(2);SuperClasss1=newSubClass(2,3.4);s.display();s1.display();}}classSuperClass{privateintx;publicSuperClass(intx1){x=x1;}publicvoiddisplay(){System.out.println(x);}}classSubClassextendsSuperClass{privatedoubley;publicSubClass(intx,doubley){super(x);this.y=y;}publicvoiddisplay(){System.out.println(y);}}A.2B.2C.3.4D.3.43.423.42
本文标题:09级Java技术试题
链接地址:https://www.777doc.com/doc-3120983 .html