java单选题版doc.docx
- 文档编号:17350218
- 上传时间:2023-07-24
- 格式:DOCX
- 页数:64
- 大小:28.13KB
java单选题版doc.docx
《java单选题版doc.docx》由会员分享,可在线阅读,更多相关《java单选题版doc.docx(64页珍藏版)》请在冰点文库上搜索。
java单选题版doc
1.HowmanybytesofstoragearerequiredforanintegeroftypelonginJav
a?
(b)
(a)Four
(b)Eight
(c)Two
(d)Three
注java中有8种基本类型byte:
8位无符号整数short:
16位有符号整数臧
廷杰
int32位有符号整数long:
64(8字节)位有符号整数float:
32位单精度浮点数
double:
64位单精度浮点数char:
单个字符使用16位Unicode编码boolean
2.
ThetwoBooleanliteralsavailableinJavaare_____and_____.(d)
(a)T,F
(b)0,1
(c)TRUE,FALSE
(d)true,false
3.
ConsiderthefollowinglineofJavacode.(c)
intx=1+7*2;
Whatwillbethevalueofxattheendofexecutionofthelineofcode?
(a)21
(b)16
(c)15
(d)9
4.
Howmanylinesofoutputwillbeproducedbythefollowingcodefragment?
(d)
for(inti=0;i<4;++i){
for(intj=1;j<3;++j){
stdOut.println(i+j);
(a)10
(b)12
(c)6
(d)8
5.
WhichistheJavakeywordusedtodenoteaclassmethod?
(d)
(a)class
(b)private
(c)final
(d)static6
?
?
?
AccordingtoJavadocconvention,thefirstsentenceofeachJavadoccomment
shouldbe(c)
(a)an@authortag
(b)theorderoflinesisnotimportant
(c)asummarysentenceofthedeclaredentry
(d)an@versiontag
7.
ThecodingsystemusedtorepresentcharactersinJavais(c)
(a)bytecode
(b)ASCII
(c)Unicode
(d)EBCDIC
8.
Whichexpressionbelowevaluatestotrueifandonlyifxisintherange[0,
9](inclusive)?
(a)
(a)!
(x<0||x>9)
(b)0 (c)0<=x>=9 (d)x>0&&x<9 9. Whichofthefollowingisavalidintegerconstantdeclaration? (a) (a)finalintSCALE=10; (b)intfinalSCALE=10; (c)finalSCALE=10; (d)intSCALE=10; 10. WhichofthefollowingisavalidcharacterliteralinJava? (注意字符与字符串 的表示)(a) (a)'' (b)"'" (c)"a" (d)'<=' 11. Whichofthefollowingisnotequivalentinvaluetothefollowingexpre ssion? (b) flag==false (a)flag! =true (b)flag (c)! flag (d)! (flag==true)臧廷杰 12.Whichofthefollowingstatementsisusedtoexitfromaswitchstatemen t? (a) (a)break; (b)end; (c)exit; (d)default; 13. WhichofthefollowingisnotalegalidentifierinJava? (c) (a)first_index (b)$first_index (c)1index (d)index1 14. InJava,whatistheidentifierfortheprimitivetypeusedtorepresentachar acter? (b) (a)Character (b)char (c)character (d)Char 15. WhichofthefollowingisavalidliteraloftypefloatinJava? (c) (a)10.5sp (b)10.5fp (c)10.5f (d)10.5d 16. WhichofthefollowingstatementsaboutconstructorsinJavaistrue? (a) (a)Aclasscandefinemorethanoneconstructor. (b)Aclassmustdefineatleastoneconstructor. (c)Aconstructormustbedefinedaspublic. (d)Aconstructormustbedefinedasstatic. .17.Accordingtothedocumententitled CodeConventionsfortheJavaProgrammingLanguage,filesuffixesusedbyJava softwareincludewhichofthefollowing? (b) I..obj II..class III..h (a)IandIIonly (b)IIonly (c)IIandIIIonly (d)IandIIIonly 18.Astacktraceis(c)臧廷杰 (a)alistofvariablesallocatedonaprogram'sstack (b)afatalerrorthatcausesatypicaldebuggertoterminate (c)asequenceofmethodcalls (d)onlyavailablethroughatypicaldebugger'sstepintofeature 注堆栈轨迹: 如果你需要打印出某个时间的调用堆栈状态你将产生一个堆栈轨迹。 stacktrace中包括三部分分别为.bss.text.data bss表示程序中未初始化的全局变量的一块内存区域 text表示程序中已初始化的全局变量的一块内存区域 data表示存放程序执行代码的一块内存区域 19.WhichmethodmustexistineveryJavaapplication? (a)begin (b)paint (c)init (d)main Correctansweris(d) 20.AJavaidentifiermaybeginwithallbutwhichofthefollowing? (a)$ (b)if (c)_(theunderscore) (d)0 Correctansweris(d) 21.InthecontextofJavaprogramming,garbagecollectionrefersto (a)automaticbalancingofparenthesisperformedbysomeeditors (b)removalofJavaprogramsthatcouldcausedamagetoasystem (c)conversionofcommentsintoJavadoccomments (d)automaticreturnofmemorytotheheapforobjectsnolongerrequiredbythe program Correctansweris(d) 22.WhatwillbeoutputwhenthefollowingJavaprogramsegmentisexecuted? intx=5; inty=2; System.out.println(x+y); (a)5+2 (b)52 (c)7 (d)52 Correctansweris(c)23.Whichofthefollowingpartsofanif-else-statementisoptional? (a)theifpart (b)theelsepart (c)theparenthesisaroundthecondition (d)thecondition Correctansweris(b) 24.WhichofthefollowingistheJavaloopconstructtypicallyusedwhentherange isclear? (a)while-loop (b)for-loop (c)switch-loop (d)do-while-loop Correctansweris(b) 25.ConsiderthefollowingJavaprogramsegment. importjava.io.*; publicclassTest{ publicTest(){ System.out.println("default"); } publicTest(inti){ System.out.println("non-default"); } publicstaticvoidmain(String[]args){ Testt=newTest (2); } } Whichofthefollowingwillbeoutputduringexecutionoftheprogramsegment? (a)Thelineoftext"non-default"followedbythelineoftext"default" (b)Thelineoftext"default"followedbythelineoftext"non-default" (c)Thelineoftext"default" (d)Thelineoftext"non-default" Correctansweris(d) 26.WhatisthenameoftheJDKprogramthatprocessesJavadoccomments? (a)java(b)javac (c)javacom (d)javadoc Correctansweris(d) 27.AccordingtotheJavacodeconventions,fileslongerthan_____linesshouldbe _____. (a)100,encouraged (b)100,avoided (c)2000,avoided (d)2000,encouraged Correctansweris(c) 28.Theprimitivefloating-pointtypesavailableinJavaare_____and_____. (a)real,double (b)float,double (c)real,float (d)single,real Correctansweris(b) 29.HowmanybytesarerequiredtorepresentaUnicode统一的字符编码标准采用 双字节character? (a)Four (b)One (c)Three (d)Two Correctansweris(d) 30.Howmanylinesofoutputwillbeproducedbythefollowingcodefragment? for(inti=0;i<3;++i){ for(intj=0;j stdOut.println(i+j); }} (a)6 (b)4 (c)3 (d)5 Correctansweris(c) 31.WhichofthefollowingstatementsaboutclassvariablesinJavaisnottrue? (a)Classvariablesrequirethemodifierstaticinthedeclarations.(b)Allobjectshavetheirowncopyoftheclassvariabledefinedintheinstantiated class. (c)Non-staticmethodsinaclasscanaccesstheclassvariabledefinedinthesame class. (d)Classvariablesdonotneedthereferencetotheobjectoftheinstantiatedclass toaccessthem. Correctansweris(b) 32.Thetermclassvariableisasynonymfor (a)aninstancevariable (b)aread-onlyvariable (c)aprivatedatafield (d)astaticdatafield Correctansweris(d) 33.WhichofthefollowingpatternsofcharactersopensaJavadoccommentblock? (a)/** (b)// (c)/* (d)**/ Correctansweris(a) 34.Thetermwrapperclassesrefersto (a)theJavaclassesthatcontainatleasttwodatafields (b)theJavaclassesthatcontainthemselves (c)acollectionofJavaclassesthat"wrap"Javaprimitivetypes (d)acollectionofJavaclassesthatcontainotherJavaclasses Correctansweris(c) 35.Giventhefollowingcode,whatvaluewillbeoutputbythelaststatement? StringTokenizerst=newStringTokenizer("thisis,a,testoftokens",","); Strings; intcount=0; while(st.hasMoreTokens()){ s=st.nextToken(); ++count; }stdOut.println(count); (a)3 (b)1 (c)6 (d)4 Correctansweris(a) 注好像是根据逗号划分 36.ConsiderthefollowingJavaprogramsegment. intx=5; inty=2; System.out.println(x+"1"+y); Whichofthefollowingstatementsistrueabouttheprogramsegment? (a)Theoutputcausedbythecodewillbe512. (b)Theoutputcausedbythecodewillbe8. (c)Thecodewillcauseacompilationerror. (d)Theoutputcausedbythecodewillbe512. Correctansweris(a) 37.ConsiderthefollowingJavaprogramsegment. importjava.io.*; publicclassSomeClass{ publicvoidx(){ thrownewRuntimeException("Exceptionfromx"); } publicvoidy(){ thrownewIOException("Exceptionfromy"); } } Whichofthefollowingistrueconcerningthedefinitionsforthemethodsxandy? (a)Neitherxnoryhasalegaldefinition. (b)Bothxandyhavelegaldefinitions. (c)xhasalegaldefinition,butyhasanillegaldefinition. (d)xhasanillegaldefinition,butyhasalegaldefinition. Correctansweris(c) 38.InJava,exceptionsthatarenothandledarepassedupthe (a)exceptionladder (b)callstack (c)catchblocks (d)blockhierarchy Correctansweris(b) 39.Afteratypicaldebuggerencountersabreakpoint,theprogrammerusingthe debuggermayperformwhichofthefollowingactions? 1.Examinethevaluesofvariablesinthehaltedprogram 2.Executethecurrentline当前行 3.Resume重新开始executionofthehalted停止program (a)IIIonly (b)I,II,andIII (c)Ionly (d)IandIIonly Correctansweris(b) 40.ThenameofaJavasourcefile (a)mustusetheextension.class (b)mustbethesameastheclassitdefines,respectingcase (c)mustbethesameastheclassitdefines,ignoringcase (d)hasnorestrictions Correctansweris(b) 41.Adifferencebetweenthemethodsprintandprintlnoftheclass java.io.PrintWriteristhat (a)printlnappendsanewlinetotheendofitsoutput,butprintdoesnot (b)printappendsanewlinetotheendofitsoutput,butprintlndoesnot (c)printlninsertsanewlineatthebeginningofitsoutput,butprintdoesnot (d)printinsertsanew
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 选题 doc
![提示](https://static.bingdoc.com/images/bang_tan.gif)