欢迎来到天天文库
浏览记录
ID:55550533
大小:38.00 KB
页数:10页
时间:2020-05-16
《Java东华理工大学试卷A及答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、东华理工大学2012—2013学年第1学期考试试卷Java程序设计课程闭课程类别:考查A题号一二三四五六七八九总分分数评卷人1选择题(共35分)1.Whatissuffix(后缀)ofJavasourcecode?(A)?A、.javaB、.classC、.txtD、.ext2.WhichcommandcancompileJavasourcecode?(D)?A、editB、dirC、javaD、javac3.Whichidentifiesisillegal(C)?A、$_$123B、_somethingC、
2、some**nameD、you_can_al4.Whichconversion(转换)isillegal(B)?注意:byte类型的范围-128-127A、shortx=1000;B、bytex=1000;C、bytex=100;D、floatx=12L;5.classexample{publicstaticvoidmain(Stringargs[]){booleanb;b=(2>3)&&(3<2);System.out.print("b="+b);b=false
3、
4、true;System.out.print
5、ln("b="+b);}}Whatistheresult?(A)A、b=falseb=trueB、b=trueb=falseC、b=trueb=trueD、b=falseb=false6.classexample{publicstaticvoidmain(Stringargs[]){inti=1;a[i++]=a[i++]+2;System.out.println(a[i++]);}}Whatistheresult?(C)A,4B,5C3,D,67.publicclassExample{ Stringstr
6、=newString("good"); char[]ch={'a','b','c'}; publicstaticvoidmain(Stringargs[]){ Exampleex=newExample(); ex.change(ex.str,ex.ch); System.out.print(ex.str+"and"); Sytem.out.print(ex.ch);} publicvoidchange(Stringstr,charch[]){ str="testok";
7、 ch[0]='g'; }}Whatistheresult?(D)AgoodandabcBgoodandgbcCtestokandabcDtestokandgbc8.Setx=1,y=2,z=3,expression:y+=z--/++xwhatisresult(A)A3B3.5C4D59.whatisresult(A)?classexample{staticinta=3;publicstaticvoidmain(Stringargs[]){newexample().a++;newexample().a+=
8、2;System.out.println(example.a);}}A6B7C4D510.1.classX{(D)2.publicstaticvoidmain(Stringargs[]){3.Strings1=newString(“true”);4.Booleanb1=newBoolean(true);5.if(s1.equals(b1)){6.System.out.println(“equal”);}}}AtheprogramrunsandprintsnothingBtheprogramrunsandpri
9、nts“equal”CAnerroratline5causescompilationtofailDTheprogramrunsbutabortswithanexception11.1.interfaceA{2.inta=3;3.voidshow();4.}5.classBimplementA{6.voidshow(){}7.publicstaticvoidmain(Stringargs[]){8.System.out.println(a++);}}Whichlinesareincorrectwhentheco
10、deiscompiled?(C)A57B68C568D5612classA{inta=2;}classBextendsA{inta=3;}classtest{publicstaticvoidmain(Stringargs[]){Ag=newB();//不能把子类的东西给父类System.out.println(g.a);}}Whatisresult?(B)A2BnoresultC1D313whati
此文档下载收益归作者所有