欢迎来到天天文库
浏览记录
ID:14665174
大小:41.28 KB
页数:18页
时间:2018-07-29
《java双语教学考试试卷及答案a》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、班级学号姓名密封装订线密封装订线密封装订线A卷注意事项:请将各题答案按编号顺序填写到答题卷上,答在试卷上无效。一、单项选择题(1~20每小题1分,21~30每小题2分,共40分)1.WhicharekeywordsinJava?A.NullB.TRUEC.sizeofD.implements2.Considerthefollowingcode:Integers=newInteger(9);Integert=newInteger(9);Longu=newLong(9);Whichtestwouldreturntrue?A.(s.equ
2、als(newInteger(9))B.(s.equals(9))C.(s==u)D.(s==t)3.Whichstatementofassigningalongtypevariabletoahexadecimalvalueiscorrect?A.longnumber=345L; B.longnumber=0345;C.longnumber=0345L;D.longnumber=0x345L;4.Whichlayoutmanagerisusedwhentheframeisresizedthebuttons'spositionint
3、heFramemightbechanged?A.BorderLayout B.FlowLayout C.CardLayout D.GridLayout5.WhicharenotJavaprimitivetypes?A.short B.Boolean C.byte D.float6.Giventhefollowingcode: if(x>0){System.out.println("first");} elseif(x>-3){System.out.println("second");} else{System.ou
4、t.println("third");}Whichrangeofxvaluewouldprintthestring"second"? A.x>0 B.x>-3 C.x<=-3 D.x<=0&x>-37.Giventhefollowingcode:publicclassPerson{intarr[]=newint[10];publicstaticvoidmain(Stringa[]){ System.out.println(arr[1]); }}面向对象程序设计(JAVA)第18页共18页Whichstatementisc
5、orrect?A.Whencompilationsomeerrorwilloccur.B.Itiscorrectwhencompilationbutwillcauseerrorwhenrunning.C.Theoutputiszero.D.Theoutputisnull.1.Shortanswer:Thedecimalvalueofiis13,theoctalivalueis:A.14B.015C.0x14D.0122.ApublicmembervairablecalledMAX_LENGTHwhichisinttype,theva
6、lueofthevariableremainsconstantvalue100.Useashortstatementtodefinethevariable.A.publicintMAX_LENGTH=100; B.finalintMAX_LENGTH=100;C.finalpublicintMAX_LENGTH=100; D.publicfinalintMAX_LENGTH=100.3.WhichcorrectlycreateanarrayoffiveemptyStrings?A.Stringa[]={"","","","",""
7、,""};B.Stringa[5];C.String[5]a;D.String[]a=newString[5];for(inti=0;i<5;a[i++]=null);4.Giventhefollowingmethodbody:{if(sometest()){unsafe();}else{safe();}}Themethod"unsafe"mightthrowanIOException(whichisnotasubclassofRunTimeException).Whichcorrectlycompletesthemethodofd
8、eclarationwhenaddedatlineone?A.publicvoidmethodName()throwsExceptionB.publicvoidmethodname()C.publicvoidmethodName()t
此文档下载收益归作者所有