面向对象程序设计智慧树知到期末考试答案章节答案2024年齐鲁工业大学_第1页
面向对象程序设计智慧树知到期末考试答案章节答案2024年齐鲁工业大学_第2页
面向对象程序设计智慧树知到期末考试答案章节答案2024年齐鲁工业大学_第3页
面向对象程序设计智慧树知到期末考试答案章节答案2024年齐鲁工业大学_第4页
面向对象程序设计智慧树知到期末考试答案章节答案2024年齐鲁工业大学_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

面向对象程序设计智慧树知到期末考试答案+章节答案2024年齐鲁工业大学Whichsuperclassmembersareinheritedbyallsubclassesofthatsuperclass?()

答案:protectedinstancevariablesandmethods.Inarrayitems,whichexpressionbelowaccessesthevalueatrow3andcolumn4?()

答案:items[3][4]WhichofthefollowingisnotapackageintheJavaAPI?()

答案:ponentWhichexpressionadds1totheelementofarrayarrayNameatindexi?()

答案:++arrayName[i].GiventheJavastatementnumber1=input.nextInt();inwhichnumber1isanintandinputisaScanner,whichofthefollowingoccursiftheuserdoesnotenteravalidintvalue?()

答案:Aruntimelogicerroroccurs.WhichstatementcorrectlypassesthearrayitemstomethodtakeArray?Arrayitemscontains10elements.()

答案:takeArray(items).Whichofthefollowingstatementsdescribesblockscope?()

答案:Itbeginsattheidentifier'sdeclarationandendsattheterminatingrightbrace(}).Whichofthefollowingwillnotproduceacompilererror?()

答案:Changingthevalueatagivenindexofanarrayafteritiscreated.Allofthefollowingmethodsareimplicitlyfinalexcept:()

答案:amethodinanabstractclass.Thecontrolvariableofacounter-controlledloopshouldbedeclaredas________topreventerrors.()

答案:intWhichofthefollowingstatementsabouttheconditionaloperator(?:)isfalse?()

答案:Thesecondoperandistheresultvalueiftheconditionevaluatestofalse.Whichofthefollowingcodesegmentsdoesnotincrementvalby3:()

答案:c=3;val=val+(c==3?2:3);ThefilenameforthepublicclassthatbeginswithpublicclassAdditionmustbe()

答案:Addition.java.Whichofthefollowingstatementsis?()

答案:Variablesoftypefloatrepresentdouble-precisionfloating-pointnumbers;theserequiretwiceasmuchmemoryasdoublevariables.Whichofthefollowingescapesequencesrepresentsacarriagereturn?()

答案:\r.Methodcallscannotbedistinguishedby________.()

答案:returntypeInanactivitydiagram,themergesymbolhasthesameshapeaswhatothersymbol?()

答案:Decisionsymbol.InJavaSE7andearlier,aninterfacemaycontain:()

答案:publicstaticfinaldataandpublicabstractmethods.WhichofthefollowingisnotatypeofrepetitionstatementinJava?()

答案:loopstatement.Compositionissometimesreferredtoasa(n)________.()

答案:has-arelationshipAconstructorcannot:()

答案:specifyreturntypesorreturnvalues.Animportdeclarationisnotrequiredifyoualwaysrefertoaclasswithits________name,whichincludesitspackagenameandclassname.()

答案:fullyqualifiednameProgramsremembernumbersandotherdatainthecomputer'smemoryandaccessthatdatathroughprogramelementscalled()

答案:variables.Anoverloadedmethodisonethat________.()

答案:hasthesamenameasanothermethod,butdifferentparameters(bynumber,typesororderofthetypes)ClassArraysmethodssort,binarySearch,equalsandfillareoverloadedforprimitive-typearraysandObjectarrays.Inaddition,methods__________and__________areoverloadedwithgenericversions.()

答案:binarySearch,equals.Whichofthefollowingwouldnotbeusedtoclarifyadangling-else?()

答案:Parentheses().

答案:Both(a)and(b)aretrue.Whichofthefollowingstatementscreatesamultidimensionalarraywith3rows,wherethefirstrowcontains1element,thesecondrowcontains4elementsandthefinalrowcontains2elements?()

答案:int[][]items={{1},{2,3,4,5},{6,7}};Whichofthefollowingwillcountdownfrom10to1correctly?()

答案:for(intj=10;j>=1;j--)Primitive-typelocalvariablesareinitializedbydefault.()

答案:错Animportdeclarationisnotrequiredwhenoneclassinapackageusesanotherinthesamepackage.()

答案:对Everymethod’sbodyisdelimitedbyleftandrightbraces({and}).()

答案:对Byconvention,methodnamesbeginwithanuppercasefirstletter,andallsubsequentwordsinthenamebeginwithacapitalfirstletter.()

答案:错Whichofthefollowingclassmembersshouldusuallybeprivate?()

答案:Variables(orfields).Whichofthefollowingoperatorsassociatesfromlefttoright?()

答案:/Forthearraythatwasthecorrectanswerinthepreviousquestion,whatisthevaluereturnedbyitems[1][0]?()

答案:6.

答案:AllfourmethodsareoverloadedClassArraysprovidesmethod__________forcomparingarraystodeterminewhethertheyhavethesamecontents.()

答案:equalsWhenanobjectisconcatenatedwithaString,________.()

答案:theobject’stoStringmethodisimplicitlycalledtoobtaintheStringrepresentationoftheobject

答案:Noneoftheabove.Whichofthefollowingstatementsisfalse?()

答案:Usetheaccessmodifierpackagetogiveamethodorvariablepackageaccess.Whichofthefollowingprimitivetypesisneverpromotedtoanotherprimitivetype?()

答案:Bothaandc.Whichoperatorcanbeusedinstringconcatenation?()

答案:+=Declaringinstancevariables________isknownasdatahidingorinformationhiding.()

答案:privateWhichofthefollowingdoesnotcompletethesentencecorrectly?Interface______.()

答案:canbeinstantiated.Portionsofstatementsthatcontaincalculationsarecalled()

答案:expressions.

答案:Thisporridgeistoohot!Thisporridgeisjustright!Counter-controlledrepetitionisalsoknownas:()

答案:DefiniterepetitionAttemptingtoaccessanarrayelementoutsideoftheboundsofanarray,causesa(n).()

答案:ArrayIndexOutOfBoundsException.Anargumenttypefollowedbya(n)_______inamethod’sparameterlistindicatesthatthemethodreceivesavariablenumberofargumentsofthatparticulartype.()

答案:ellipsis(...)Havingathisreferenceallows:()

答案:Alloftheabove.Whenmethodprintfrequiresmultiplearguments,theargumentsareseparatedwith________.()

答案:commas(,).WhichofthefollowingisnotaJavaprimitivetype?()

答案:realWhichofthefollowingstatementsistrue?()

答案:Alloftheabovearetrue.Thestaticmethod________ofclassStringreturnsaformattedString.()

答案:format.IdentifiersinJavahave________and________scopes?()

答案:class,block.Whichofthefollowingwillnothelppreventinfiniteloops?()

答案:Includebracesaroundthestatementsinado…whilestatement.Polymorphismallowsforspecificstobedealtwithduring:()

答案:execution.Inanexpressioncontainingvaluesofthetypesintanddouble,the________valuesare________to________valuesforuseintheexpression.()

答案:int,promoted,double.Whichofthefollowingpromotionsofprimitivetypesisnotallowedtooccur?()

答案:doubletofloat.Whichofthesestatementsbestdefinesscope?()

答案:Scopeistheportionofaprogramthatcanrefertoanentitybyitssimplename.A(n)________indicatesaproblemthatoccurswhileaprogramexecutes.()

答案:exceptionTheformatspecifier%.2fspecifiesthattwodigitsofprecisionshouldbeoutput________inthefloating-pointnumber.()

答案:totherightofthedecimalpointWhichstatementbestdescribestherelationshipbetweensuperclassandsubclasstypes?()

答案:Asubclassreferencecanbeassignedtoasuperclassvariable,butasuperclassreferencecannotbeassignedtoasubclassvariable.Localvariablesmustbe________.()

答案:initializedbeforetheirvaluesareusedinanexpression.Whenasubclassconstructorcallsitssuperclassconstructor,whathappensifthesuperclass’sconstructordoesnotassignavaluetoaninstancevariable?()

答案:Theprogramcompilesandrunsbecausetheinstancevariablesareinitializedtotheirdefaultvalues.Sentinel-controlledrepetitionisalsoknownas________.()

答案:IndefiniterepetitionInvalidpossibilitiesforarrayindicesinclude.()

答案:Negativeintegers.Whatistheresultvalueofcattheendofthefollowingcodesegment?intc=8;c++;++c;c%=5;()

答案:0.Wherecanlocalvariablesdeclaredwithinamethod’sbodybeused?()

答案:Onlyinthatmethodbetweenthelineinwhichtheyweredeclaredandtheclosingbraceofthatmethod.Whichofthefollowingisnotpossible?()

答案:Aclassthatinheritsfromtwoclasses.Staticclassvariables:()

答案:aresharedbyallobjectsofaclass.Whichstatementistruewhenasuperclasshasprotectedinstancevariables?()

答案:Alloftheabove.WhichcommandbelowrunsTestProgram,andpassesinthevaluesfiles.txtand3?()

答案:javaTestProgramfiles.txt3.Whichexpressionisequivalenttoif(!(grade==sentinelValue))?()

答案:if(grade!=sentinelValue)EveryobjectinJavaknowsitsownclassandcanaccessthisinformationthroughmethod.()

答案:getClass.Assigningasubclassreferencetoasuperclassvariableissafe________.()

答案:becausethesubclassobjectisanobjectofitssuperclass.Whichofthefollowingstatementsaboutabstractsuperclassesistrue?()

答案:abstractsuperclassesmaycontaindata.Whenasuperclassvariablereferstoasubclassobjectandamethodiscalledonthatobject,theproperimplementationisdeterminedatexecutiontime.Whatistheprocessofdeterminingthecorrectmethodtocall?()

答案:latebinding.A(n)_____classcannotbeinstantiated.()

答案:abstract.Classesandmethodsaredeclaredfinalforallbutthefollowingreasons:()

答案:finalmethodsarestatic.Whichofthefollowingcouldbeusedtodeclareabstractmethodmethod1inabstractclassClass1(method1returnsanintandtakesnoarguments)?()

答案:publicabstractintmethod1();ConsiderclassesA,BandC,whereAisanabstractsuperclass,BisaconcreteclassthatinheritsfromAandCisaconcreteclassthatinheritsfromB.ClassAdeclaresabstractmethodoriginalMethod,implementedinclassB.WhichofthefollowingstatementsistrueofclassC?()

答案:Noneoftheabove.Non-abstractclassesarecalled________.()

答案:concreteclasses.Ifthesuperclasscontainsonlyabstractmethoddeclarations,thesuperclassisusedfor________.()

答案:interfaceinheritance.Anadvantageofinheritanceisthat:()

答案:Objectsofasubclasscanbetreatedlikeobjectsoftheirsuperclass.Superclassmethodswiththislevelofaccesscannotbecalledfromsubclasses.()

答案:private.Usingtheprotectedkeywordalsogivesamember:()

答案:packageaccess.Inheritanceisalsoknownasthe()

答案:is-arelationship.Whichofthefollowingkeywordsallowsasubclasstoaccessasuperclassmethodevenwhenthesubclasshasoverriddenthesuperclassmethod?()

答案:super.Overridingamethoddiffersfromoverloadingamethodbecause:()

答案:Overriddenmethodshavethesamesignature.Whichofthefollowingisnotasuperclass/subclassrelationship?()

答案:Sailboat/Tugboat.EveryclassinJava,except________,extendsanexistingclass.()

答案:Object.Whichofthefollowinginitializerlistswouldcorrectlysettheelementsofarrayn?()

答案:int[]n={1,2,3,4,5};Whichstatementcreatesarandomvaluefromthesequence2,5,8,11and14.SupposerandomNumbersisaSecureRandomobject.()

答案:2+3*randomNumbers.nextInt(5);Whichofthefollowingstatementsaboutcreatingarraysandinitializingtheirelementsisfalse?()

答案:Theelementsofanarrayofintegershaveavalueofnullbeforetheyareinitialized.Whichofthefollowingstatementsaboutarraysaretrue?1:Anarrayisagroupofvariablescontainingvaluesthatallhavethesametype.2:Elementsarelocatedbyindex.3:Thelengthofanarraycisdeterminedbytheexpressionc.length();4:Thezerothelementofarraycisspecifiedbyc[0].()

答案:1,2,4Aprogrammermustdothefollowingbeforeusinganarray:()

答案:declarethencreatethearray.Arraysare________.()

答案:fixed-lengthentitiesAsetofnamedconstantsthatstartwiththevalue0forthefirstconstantandincrementby1foreachsubsequentconstantcanbedeclaredasa(n)________.()

答案:enumTypesinJavaaredividedintotwocategories.Theprimitivetypesareboolean,byte,char,short,int,long,floatanddouble.Allothertypesare________types.()

答案:referenceMathstaticmethodrandomgeneratesarandomdoublevalueintherangefrom0.0()

答案:uptobutnotincluding1.0Considerthecodesegmentbelow.Whichofthefollowingstatementsisfalse?int[]g;g=newint[23];()

答案:Thevalueofg[3]is-1.Todeclareamethodasstatic,placethekeywordstaticbefore________inthemethod’sdeclaration.()

答案:thereturntypeInformationispassedtoamethodin________.()

答案:theargumentstothemethodAwell-designedmethod________.()

答案:performsasingle,well-definedtaskWhichofthefollowingmethodsisnotintheMathclass?()

答案:parseIntAnyclassthatcontainspublicstaticvoidmain(String[]args)canbeusedtoexecuteanapp.()

答案:对WhichisacorrectstaticmethodcallofMathclassmethodsqrt?()

答案:Math.sqrt(900);Reference-typeinstancevariablesareinitializedbydefaulttothevaluenull.()

答案:对Aprimitive-typevariablecanbeusedtoinvokeamethod.()

答案:错Emptyparenthesesfollowingamethodnameinamethoddeclarationindicatethatthemethoddoesnotrequireanyparameterstoperformitstask.()

答案:对Variablesdeclaredinthebodyofaparticularmethodareknownasinstancevariablesandcanbeusedinallmethodsoftheclass.()

答案:错Whenamethodterminates,thevaluesofitslocalvariablesare________.()

答案:lostFloating-pointvaluesthatappearinsourcecodeareknownasfloating-pointliteralsandaretypefloatbydefault.()

答案:错Eachclassyoucreatebecomesanew________thatcanbeusedtodeclarevariablesandcreateobjects.()

答案:type.Thenumberofargumentsinthemethodcallmustmatchthenumberofparametersinthemethoddeclaration’sparameterlist.()

答案:对Whichofthefollowingisnotacontrolstructure:()

答案:Declarationstructure.Whichofthefollowingisnotacompilationerror?()

答案:Placingasemicolonattheendofthefirstlineofanifstatement.Whichofthefollowingstatementsdoesnotalterthevaluestoredinamemorylocation?()

答案:inta;Optionalparenthesesinexpressionsaresaidtobe()

答案:redundant.Eachofthefollowingisarelationalorequalityoperatorexcept:()

答案:=!Whichofthefollowingisadouble-selectioncontrolstatement?()

答案:if…elseWhichofthefollowingcanbeusedinaswitchstatementintheexpressionafterkeywordcase?a.aconstantinteg

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论