版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
面向對象程序設計知到智慧樹章節(jié)測試課后答案2024年秋齊魯工業(yè)大學第一章單元測試
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. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 微波課程設計結論
- 2024年中國塑料瞳顯距離尺市場調查研究報告
- 2025版旅游度假區(qū)開發(fā)商物業(yè)移交與旅游服務協議3篇
- 2024年中國不可視室內機市場調查研究報告
- 2024年中國SD卡座市場調查研究報告
- 2025至2030年中國高速AD/DA轉換器行業(yè)投資前景及策略咨詢研究報告
- 2025年度智能城市建設項目勞動合同證明書2篇
- 2025年度網絡安全技術研發(fā)承包合同
- 液壓機械臂課程設計
- 2025版?zhèn)€人商鋪租賃附帶違約責任明確合同范本3篇
- 塑料模具肥皂盒設計說明書
- 穿越河流工程定向鉆專項施工方案
- 地球物理學進展投稿須知
- 社會主義新農村建設建筑廢料利用探究
- 解析電力施工項目的信息化管理
- 火炬介紹 音速火炬等
- 制劑申請書(共16頁)
- 《質量守恒定律》評課稿
- 人教版七年級上冊地理《第4章居民與聚落 第3節(jié)人類的聚居地——聚落》課件
- 對縣委常委班子及成員批評意見范文
- 數據中心IDC項目建議書
評論
0/150
提交評論