




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
面向对象程序设计知到智慧树章节测试课后答案2024年秋齐鲁工业大学第一章单元测试
WhicheditionofJavaisgearedtowarddevelopinglarge-scale,distributednetworkingapplicationsandweb-basedapplications?()
A:EnterpriseEdition.
B:IndustrialEdition.
C:StandardEdition.
D:MicroEdition.
答案:EnterpriseEdition.
Javawasoriginallydevelopedfor:()
A:Distributedcomputing.
B:Operatingsystemsdevelopment.
C:Personalcomputers.
D:Intelligentconsumerdevices.
答案:Intelligentconsumerdevices.
WhichofthefollowingstatementsaboutJavaClassLibrariesisfalse:()
A:Javaclasslibrariesconsistofclassesthatconsistofmethodsthatperformtasks.
B:AnadvantageofusingJavaclasslibrariesissavingtheeffortofdesigning,developingandtestingnewclasses.
C:JavaclasslibrariesarealsoknownasJavaAPIs(ApplicationProgrammingInterfaces).
D:Javaclasslibrariesarenotportable
答案:Javaclasslibrariesarenotportable
The.classextensiononafilemeansthatthefile:()
A:Containsjavasourcecode
B:Noneoftheabove.
C:ContainsHTML
D:isproducedbytheJavacompiler(javac).
答案:isproducedbytheJavacompiler(javac).
Thecommand________executesaJavaapplication.()
A:java
B:run
C:javac
D:Noneoftheabove
答案:java
第二章单元测试
End-of-linecommentsthatshouldbeignoredbythecompileraredenotedusing()
A:Threeforwardslashes(///).
B:Aslashandtwostars(/**).
C:Twoforwardslashes(//).
D:Aslashandastar(/*).
答案:Twoforwardslashes(//).
WhichofthefollowingisnotavalidJavaidentifier?()
A:width
B:myValue
C:$_AAA1
D:m_x
答案:myValue
WhichofthefollowingcannotcauseasyntaxerrortobereportedbytheJavacompiler?()
A:Mismatched{}
B:Missing;
C:Missing*/inacommentthatbeginswith/*
D:Anextrablankline.
答案:Anextrablankline.
Whichofthefollowingdoesnotcontainasyntaxerror?()
A:System.out.println("Helloworld!");
B:System.out.println('Helloworld!'):
C:System.out.println("Hello回车换行world!");
D:System.out.println(Helloworld!);
答案:System.out.println("Helloworld!");
WhichcommandcompilestheJavasourcecodefileWelcome.java?()
A:javacWelcome.java
B:compileWelcome.java
C:javaWelcome.java
D:cdWelcome.java
答案:javacWelcome.java
WhichcommandexecutestheJavaclassfileWelcome.class?()
A:javaWelcome.class
B:runWelcome.class
C:javawelcome
D:javaWelcome
答案:javaWelcome
Whichistheoutputofthefollowingstatements?
()
A:WorldHello
B:HelloWorld
C:HelloWorld
D:HelloWorld
答案:HelloWorld
Whichstatementprintsthefloating-pointvalue123.456rightjustifiedwithafieldwidthof10?()
A:System.out.printf("%d10.3",123.456);
B:System.out.printf("%10.3f",123.456);
C:System.out.printf("%f10.3",123.456);
D:System.out.printf("%10.3d",123.456);
答案:System.out.printf("%10.3f",123.456);
Whatisthesizeinbitsofanint?()
A:8
B:16
C:64
D:32
答案:32
Whichofthefollowingistheescapecharacter?()
A:\
B:"
C:*
D:\n
答案:\
第三章单元测试
Whichofthefollowingcanbeusedinaswitchstatementintheexpressionafterkeywordcase?a.aconstantintegralexpression.b.acharacterconstant.c.aStringd.anenumerationconstant.()
A:aandb.
B:bandc
C:aandc
D:All.
答案:All.
Optionalparenthesesinexpressionsaresaidtobe()
A:binaryoperators.
B:implied.
C:redundant.
D:declared.
答案:redundant.
Whichofthefollowingstatementsdoesnotalterthevaluestoredinamemorylocation?()
A:number=12;
B:width=Integer.parseInt(input);
C:inta;
D:y=y+2;
答案:inta;
WhatisthevalueofresultafterthefollowingJavastatementsexecute(assumeallvariablesareoftypeint)?
()
A:127
B:59
C:119
D:51
答案:119
Whichofthefollowingisnotanarithmeticoperator?()
A:-
B:%
C:.
D:+
答案:.
Whichofthefollowingisnotacompilationerror?()
A:Placingasemicolonattheendofthefirstlineofanifstatement.
B:Neglectingtoinitializealocalvariableinamethodbeforeitisused.
C:Omittingtheleftandrightparenthesisfortheconditionofanifstatement.
D:Allarecompilationerrors.
答案:Placingasemicolonattheendofthefirstlineofanifstatement.
Eachofthefollowingisarelationalorequalityoperatorexcept:()
A:>
B:<=
C:==
D:=!
答案:=!
Whichofthefollowingisnotacontrolstructure:()
A:Declarationstructure.
B:Sequencestructure.
C:Repetitionstructure.
D:Selectionstructure.
答案:Declarationstructure.
Whichstatementisfalse?()
A:Unlessdirectedotherwise,thecomputerexecutesJavastatementsoneaftertheotherintheorderinwhichthey'rewritten.
B:ActivitydiagramsnormallyshowtheJavacodethatimplementstheactivity.
C:Likepseudocode,activitydiagramshelpprogrammersdevelopandrepresentalgorithms.
D:Thearrowsintheactivitydiagramrepresenttransitions,whichindicatetheorderinwhichtheactionsrepresentedbytheactionstatesoccur.
答案:ActivitydiagramsnormallyshowtheJavacodethatimplementstheactivity.
Whichofthefollowingisadouble-selectioncontrolstatement?()
A:for
B:if
C:if…else
D:do…while
答案:if…else
第四章单元测试
Thenumberofargumentsinthemethodcallmustmatchthenumberofparametersinthemethoddeclaration’sparameterlist.()
A:错B:对
答案:对Floating-pointvaluesthatappearinsourcecodeareknownasfloating-pointliteralsandaretypefloatbydefault.()
A:对B:错
答案:错Eachclassyoucreatebecomesanew________thatcanbeusedtodeclarevariablesandcreateobjects.()
A:instance
B:package
C:library
D:type.
答案:type.
Whichofthefollowingstatementsisfalse?()
A:Everyclassdeclarationcontainskeywordclassfollowedimmediatelybytheclass’sname.
B:Class,methodandvariablenamesareidentifiers.
C:Eachclassdeclarationthatbeginswiththeaccessmodifierprivatemustbestoredinafilethathasthesamenameastheclassandendswiththe.javafilenameextension.
D:Anobjecthasattributesthatareimplementedasinstancevariablesandcarriedwithitthroughoutitslifetime.
答案:Eachclassdeclarationthatbeginswiththeaccessmodifierprivatemustbestoredinafilethathasthesamenameastheclassandendswiththe.javafilenameextension.
Whichofthefollowingstatementsisfalse?()
A:Byconventionclassnamesbeginwithanuppercaseletter,andmethodandvariablenamesbeginwithalowercaseletter.
B:Instancevariablescanbedeclaredanywhereinsideaclass.
C:Instancevariablesexistbeforemethodsarecalledonanobject,whilethemethodsareexecutingandafterthemethodscompleteexecution.
D:Aclassnormallycontainsoneormoremethodsthatmanipulatetheinstancevariablesthatbelongtoparticularobjectsoftheclass.
答案:Instancevariablescanbedeclaredanywhereinsideaclass.
Whichofthefollowingstatementsistrue?()
A:Variablesormethodsdeclaredwithaccessmodifierprivateareaccessibleonlytomethodsoftheclassinwhichthey’redeclared.
B:Eachobject(instance)oftheclasssharestheclass’sinstancevariables.
C:Noneoftheaboveistrue.
D:Mostinstance-variabledeclarationsareprecededwiththekeywordpublic,whichisanaccessmodifier.
答案:Variablesormethodsdeclaredwithaccessmodifierprivateareaccessibleonlytomethodsoftheclassinwhichthey’redeclared.
Whenamethodterminates,thevaluesofitslocalvariablesare________.()
A:saved
B:copied
C:restored
D:lost
答案:lost
Whichofthefollowingstatementsistrue?()
A:ThedefaultvalueforaninstancevariableoftypeStringisvoid.
B:Theargumenttypesinthemethodcallmustbeidenticaltothetypesofthecorrespondingparametersinthemethod’sdeclaration.
C:Everyinstancevariablehasadefaultinitialvalue—avalueprovidedbyJavawhenyoudonotspecifytheinstancevariable’sinitialvalue.
D:Localvariablesareautomaticallyinitialized.
答案:Everyinstancevariablehasadefaultinitialvalue—avalueprovidedbyJavawhenyoudonotspecifytheinstancevariable’sinitialvalue.
Whichofthefollowingstatementsisfalse?()
A:Theasterisk(*)injavac*.javaindicatesthatallfilesinthecurrentdirectoryendingwiththefilenameextension.javashouldbecompiled.
B:Alloftheabovearetrue.
C:Ifthedirectorycontainingtheappincludesonlyoneapp’sfiles,youcancompileallofitsclasseswiththecommandjavac*.java.
D:Thejavaccommandcancompilemultipleclassesatonce;simplylistthesource-codefilenamesafterthecommandwitheachfilenameseparatedbyacommafromthenext.
答案:Thejavaccommandcancompilemultipleclassesatonce;simplylistthesource-codefilenamesafterthecommandwitheachfilenameseparatedbyacommafromthenext.
Whichofthefollowingstatementsisfalse?()
A:IntheUML,eachclassismodeledinaclassdiagramasarectanglewiththreecompartments.Thetoponecontainstheclass’snamecenteredhorizontallyinboldface.Themiddleonecontainstheclass’sattributes,whichcorrespondtoinstancevariablesinJava.Thebottomonecontainstheclass’soperations,whichcorrespondtomethodsandconstructorsinJava.
B:PrivateattributesareprecededbythekeywordprivateintheUML.
C:TheUMLmodelsoperationsbylistingtheoperationnamefollowedbyasetofparentheses.Aplussign(+)infrontoftheoperationnameindicatesthattheoperationisapublic.
D:UMLrepresentsinstancevariablesasanattributename,followedbyacolonandthetype.
答案:PrivateattributesareprecededbythekeywordprivateintheUML.
Emptyparenthesesfollowingamethodnameinamethoddeclarationindicatethatthemethoddoesnotrequireanyparameterstoperformitstask.()
A:对B:错
答案:对Aprimitive-typevariablecanbeusedtoinvokeamethod.()
A:错B:对
答案:错Variablesdeclaredinthebodyofaparticularmethodareknownasinstancevariablesandcanbeusedinallmethodsoftheclass.()
A:错B:对
答案:错
第五章单元测试
Reference-typeinstancevariablesareinitializedbydefaulttothevaluenull.()
A:对B:错
答案:对Anyclassthatcontainspublicstaticvoidmain(String[]args)canbeusedtoexecuteanapp.()
A:对B:错
答案:对Whichofthefollowingstatementsisfalse?()
A:Everymethod’sbodyisdelimitedbyleftandrightbraces({and}).
B:Keywordnullindicatesthatamethodwillperformataskbutwillnotreturnanyinformation.
C:Variablesdeclaredinthebodyofaparticularmethodarelocalvariablesandcanbeusedonlyinthatmethod.
D:Amethod’sparametersarelocalvariablesofthemethod.
答案:Keywordnullindicatesthatamethodwillperformataskbutwillnotreturnanyinformation.
Whichofthefollowingstatementsisfalse?()
A:Emptyparenthesesfollowingamethodnameindicatethatthemethoddoesnotrequireanyparameterstoperformitstask.
B:Themethod’sreturntypespecifiesthetypeofdatareturnedtoamethod’scaller.
C:Whenamethodthatspecifiesareturntypeotherthanvoidiscalledandcompletesitstask,themethodmustreturnaresulttoitscallingmethod
D:Classesoftenprovidepublicmethodstoallowtheclass’sclientstosetorgetprivateinstancevariables;thenamesofthesemethodsmustbeginwithsetorget.
答案:Classesoftenprovidepublicmethodstoallowtheclass’sclientstosetorgetprivateinstancevariables;thenamesofthesemethodsmustbeginwithsetorget.
Whichofthefollowingstatementsisfalse?()
A:Tocallamethodofanobject,followtheobjectnamewithacomma,themethodnameandasetofparenthesescontainingthemethod’sarguments.
B:Scannermethodnextreadscharactersuntilanywhite-spacecharacterisencountered,thenreturnsthecharactersasaString.
C:Aclassinstancecreationexpressionbeginswithkeywordnewandcreatesanewobject.
D:Aconstructorissimilartoamethodbutiscalledimplicitlybythenewoperatortoinitializeanobject’sinstancevariablesatthetimetheobjectiscreated.
答案:Tocallamethodofanobject,followtheobjectnamewithacomma,themethodnameandasetofparenthesescontainingthemethod’sarguments.
Informationispassedtoamethodin________.()
A:themethodname
B:theargumentstothemethod
C:thatmethod’sreturn
D:themethodbody
答案:theargumentstothemethod
Awell-designedmethod________.()
A:repeatscodefoundinothermethods
B:performsmultipleunrelatedtasks
C:performsasingle,well-definedtask
D:containsthousandsoflinesofcode
答案:performsasingle,well-definedtask
Todeclareamethodasstatic,placethekeywordstaticbefore________inthemethod’sdeclaration.()
A:theargumentlist
B:themethodmodifier
C:thereturntype
D:themethodname
答案:thereturntype
WhichisacorrectstaticmethodcallofMathclassmethodsqrt?()
A:sqrt(900);
B:Mathmath=newMath();math.sqrt(900);
C:Math.sqrt(900);
D:math.sqrt(900);
答案:Math.sqrt(900);
WhichofthefollowingmethodsisnotintheMathclass?()
A:parseInt
B:abs
C:log
D:ceil
答案:parseInt
第六章单元测试
Mathstaticmethodrandomgeneratesarandomdoublevalueintherangefrom0.0()
A:uptobutnotincluding1.0
B:uptoandincluding100.0
C:uptobutnotincluding100.0
D:uptoandincluding1.0
答案:uptobutnotincluding1.0
Whichstatementcreatesarandomvaluefromthesequence2,5,8,11and14.SupposerandomNumbersisaSecureRandomobject.()
A:3+2*randomNumbers.nextInt(5);
B:2+5*randomNumbers.nextInt(3);
C:5+3*randomNumbers.nextInt(2);
D:2+3*randomNumbers.nextInt(5);
答案:2+3*randomNumbers.nextInt(5);
Asetofnamedconstantsthatstartwiththevalue0forthefirstconstantandincrementby1foreachsubsequentconstantcanbedeclaredasa(n)________.()
A:class
B:Noneoftheabove.
C:enumeration
D:enum
答案:enum
Arraysare________.()
A:variable-lengthentities
B:fixed-lengthentities
C:datastructuresthatcontainupto10relateddataitems
D:usedtodrawasequenceoflines,orrays
答案:fixed-lengthentities
TypesinJavaaredividedintotwocategories.Theprimitivetypesareboolean,byte,char,short,int,long,floatanddouble.Allothertypesare________types.()
A:reference
B:source
C:static
D:declared
答案:reference
Whichofthefollowingstatementsisfalse?()
A:Variablesoftypesbyte,short,int,long,floatanddoubleareinitializedto0.
B:Primitive-typeinstancevariablesareinitializedbydefault.
C:Variablesoftypebooleanareinitializedtotrue.
D:Aprimitive-typevariablecanstoreexactlyonevalueofitsdeclaredtypeatatime.
答案:Variablesoftypebooleanareinitializedtotrue.
Whichofthefollowingstatementsaboutarraysaretrue?
1:Anarrayisagroupofvariablescontainingvaluesthatallhavethesametype.
2:Elementsarelocatedbyindex.
3:Thelengthofanarraycisdeterminedbytheexpressionc.length();
4:Thezerothelementofarraycisspecifiedbyc[0].()
A:1,3,4
B:1,2,4
C:3,4
D:1,2,3,4
答案:1,2,4
Aprogrammermustdothefollowingbeforeusinganarray:()
A:declarethenreferencethearray.
B:createthenreferencethearray.
C:declarethencreatethearray.
D:createthendeclarethearray.
答案:declarethencreatethearray.
Considerthecodesegmentbelow.Whichofthefollowingstatementsisfalse?int[]g;g=newint[23];()
A:gisareferencetoanarrayofintegers.
B:Thefirststatementdeclaresanarrayreference.
C:Thevalueofg[3]is-1.
D:Thesecondstatementcreatesthearray.
答案:Thevalueofg[3]is-1.
Whichofthefollowingstatementsaboutcreatingarraysandinitializingtheirelementsisfalse?()
A:Whenanarrayiscreatedwithoperatornew,thenumberofelementsmustbeplacedinsquarebracketsfollowingthetypeofelementbeingstored.
B:Theelementsofanarrayofintegershaveavalueofnullbeforetheyareinitialized.
C:Thenewkeywordshouldbeusedtocreateanarray.
D:Aforloopiscommonlyusedtosetthevaluesoftheelementsofanarray.
答案:Theelementsofanarrayofintegershaveavalueofnullbeforetheyareinitialized.
Whichofthefollowinginitializerlistswouldcorrectlysettheelementsofarrayn?()
A:int[]n={1,2,3,4,5};
B:intn[5]={1;2;3;4;5};
C:arrayn[int]={1,2,3,4,5};
D:intn=newint(1,2,3,4,5);
答案:int[]n={1,2,3,4,5};
第七章单元测试
Whichofthefollowingstatementsisfalse?()
A:Asuperclassobjectisasubclassobject.
B:Javausesinterfacestoprovidethebenefitsofmultipleinheritance.
C:Asubclassisoftenlargerthanitssuperclass.
D:Theclassfollowingtheextendskeywordinaclassdeclarationisthedirectsuperclassoftheclassbeingdeclared.
答案:Asuperclassobjectisasubclassobject.
Inheritanceisalsoknownasthe()
A:is-arelationship.
B:uses-arelationship.
C:knows-arelationship.
D:has-arelationship.
答案:is-arelationship.
Whichofthefollowingisnotasuperclass/subclassrelationship?()
A:Noneoftheabove.
B:Employee/HourlyEmployee.
C:Sailboat/Tugboat.
D:Vehicle/Car.
答案:Sailboat/Tugboat.
Anadvantageofinheritanceisthat:()
A:Allmethodscanbeinherited.
B:Allinstancevariablescanbeuniformlyaccessedbysubclassesandsuperclasses.
C:Noneoftheabove.
D:Objectsofasubclasscanbetreatedlikeobjectsoftheirsuperclass.
答案:Objectsofasubclasscanbetreatedlikeobjectsoftheirsuperclass.
Whichofthefollowingkeywordsallowsasubclasstoaccessasuperclassmethodevenwhenthesubclasshasoverriddenthesuperclassmethod?()
A:super.
B:base.
C:public.
D:this.
答案:super.
Usingtheprotectedkeywordalsogivesamember:()
A:publicaccess.
B:privateaccess.
C:packageaccess.
D:blockscope.
答案:packageaccess.
Superclassmethodswiththislevelofaccesscannotbecalledfromsubclasses.()
A:public.
B:private.
C:protected.
D:package.
答案:private.
Whichofthefollowingstatementsisfalse?()
A:Aclass'sinstancevariablesarenormallydeclaredprivatetoenforcegoodsoftwareengineering.
B:It'softenmuchmoreefficienttocreateaclassbyinheritingfromasimilarclassthantocreatetheclassbywritingeverylineofcodethenewclassrequires.
C:AclasscandirectlyinheritfromclassObject.
D:Iftheclassyou'reinheritingfromdeclaresinstancevariablesasprivate,theinheritedclasscanaccessthoseinstancevariablesdirectly.
答案:Iftheclassyou'reinheritingfromdeclaresinstancevariablesasprivate,theinheritedclasscanaccessthoseinstancevariablesdirectly.
EveryclassinJava,except________,extendsanexistingclass.()
A:Object.
B:Integer.
C:Class.
D:String.
答案:Object.
Overridingamethoddiffersfromoverloadingamethodbecause:()
A:Overriddenmethodshavethesamesignature.
B:Neitheroftheabove.
C:Overloadedmethodshavethesamesignature.
D:Bothoftheabove.
答案:Overriddenmethodshavethesamesignature.
第八章单元测试
A(n)_____classcannotbeinstantiated.()
A:final.
B:abstract.
C:polymorphic.
D:concrete.
答案:abstract.
Non-abstractclassesarecalled________.()
A:implementableclasses.
B:realclasses.
C:concreteclasses.
D:instanceclasses.
答案:concreteclasses.
Ifthesuperclasscontainsonlyabstractmethoddeclarations,thesuperclassisusedfor________.()
A:Neither.
B:interfaceinheritance.
C:implementationinheritance.
D:Both.
答案:interfaceinheritance.
Whichofthefollowingcouldbeusedtodeclareabstractmethodmethod1inabstractclassClass1(method1returnsanintandtakesnoarguments)?()
A:publicintmethod1();
B:publicabstractintmethod1();
C:publicintnonfinalmethod1();
D:publicintabstractmethod1();
答案:public
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 领导科学考试背景与重要性分析试题及答案
- 网络安全事件响应服务合同
- 杭州市房屋买卖合同(18篇)
- 时光都去哪了演讲稿(10篇)
- 农业发展政策与农村经济管理试题
- 财务成本管理实务模拟考试卷及答案解析
- 智能安防系统集成与安装工程合同
- 计算机三级嵌入式学习路径试题及答案
- 信息系统监理师考生如何制定计划试题及答案
- 嵌入式系统应用案例分析试题及答案
- 高中地理学业水平合格性考试必修二知识点总结(会考)
- 职业升学就业协议书
- 旅行导游协议书
- 2024年新牛津译林版三年级上册英语 Unit 1 Hello!第三课时
- 2025届百师联盟高三下学期二轮复习联考(三)地理试题(含答案)
- 新能源合伙人合同8篇
- 节目脚本委托合同协议
- 2025年下半年河北省邢台路桥建设总公司招聘50人易考易错模拟试题(共500题)试卷后附参考答案
- (二模)青岛市2025年高三年级第二次适应性检测地理试卷(含标准答案)
- 海林市社区工作者招聘真题2024
- 【检查表】粉尘涉爆企业安全生产执法检查参考标准
评论
0/150
提交评论