欢迎来到天天文库
浏览记录
ID:37845135
大小:227.42 KB
页数:10页
时间:2019-06-01
《JAVA全英试卷》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、装订线华南农业大学期末考试试卷(A卷)2011-2012学年第2学期考试科目:面向对象程序设计考试类型:(闭卷)考试考试时间:120分钟学号姓名年级专业题号一二三四总分得分评阅人得分I.Singlechoice(60points)1.WhichofthefollowingstatementscompilesOK?A.String#name="JaneDoe";B.int$age=24;C.Double_height="123.5";D.double~temp=37.5;2.WhataretheextensionnamesofJavasourcefi
2、leandexecutablefile?A..javaand.exeB..jarand.classC..javaand.classD..jarand.exe3.Given:10.classCertKiller{11.staticvoidalpha(){/*morecodehere*/}12.voidbeta(){/*morecodehere*/}13.}Whichstatementiswrong?A.CertKiller.beta()isavalidinvocationofbeta()B.CertKiller.alpha()isavalidinvo
3、cationofalpha()C.Methodbeta()candirectlycallmethodalpha()D.Themethodbeta()canonlybecalledviareferencestoobjectsofCertKiller4.WhichmethodnamedoesnotfollowtheJavaBeansstandardonAccessor/Mutator?A.getSizeB.setCustC.notAvailableD.isReadable5.ReadthefollowingclassClassA,whichstatem
4、entiscorrectafterexecuting“newClassA().getValue();”publicclassClassA{publicintgetValue(){intvalue=0;booleansetting=true;Stringtitle="Hello";if(value
5、
6、(setting&&title=="Hello")){return1;}if(value==1&title.equals("Hello")){return2;}}}A.ThereiscompilationerrorforClassAB.Itoutputs
7、2C.Itoutputs1D.ExecutesOK,butnooutput9装订线1.Given:publicvoidtestIfA(){if(testIfB("true")){System.out.println("True");}else{System.out.println("Nottrue");}}publicBooleantestIfB(Stringstr){returnBoolean.valueOf(str);}WhatistheresultwhenmethodtestIfAisinvoked?A.TrueB.NottrueC.Anex
8、ceptionisthrownatruntimeD.Compilationfails2.Given:publicclassPass{publicstaticvoidmain(String[]args){intx=5;Passp=newPass();p.doStuff(x);System.out.print("mainx="+x);}voiddoStuff(intx){System.out.print("doStuffx="+x++);}}Whatistheresult?A.doStuffx=6mainx=6B.doStuffx=5mainx=5C.
9、doStuffx=5mainx=6D.doStuffx=6mainx=53.Given:Stringa="str";Stringb=newString("str");Stringc="str";System.out.print(a==b);System.out.print(a==c);Whatistheresult?A.truefalseB.truetrueC.falsetrueD.falsefalse4.Given:33.try{34.//smoecodehere35.}catch(NullPointerExceptionel){36.Syste
10、m.out.print("a");37.}catch(RuntimeExceptionel){38.System.out.
此文档下载收益归作者所有