




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
面向對象程序設計知到智慧樹章節(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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 軟組織損傷個案護理
- 歷史文化遺產(chǎn)試題及答案集
- 《地理區(qū)域環(huán)境與人類活動教案》
- 產(chǎn)品設計原則與方法指南
- 《不同國家的文化差異比較:高三世界歷史教案》
- 新聞閱讀中的細節(jié)捕捉與信息提煉技巧:高一語文閱讀技巧講解
- 職業(yè)健康檢查技術服務合同協(xié)議書
- 共享辦公室租賃合同
- 售后服務協(xié)議書三包售后協(xié)議書
- 梭織服裝相關行業(yè)投資規(guī)劃報告范本
- 重慶市屬事業(yè)單位招聘真題2024
- 二零二五年度聘用級建造師施工技術指導聘用協(xié)議
- 牛羊定點屠宰廠項目可行性研究報告寫作模板-申批備案
- 《DeepSeek入門寶典》第4冊·個人使用篇
- 弗洛姆異化理論
- 碳納米管_ppt課件
- 【課件】第2課如何鑒賞美術作品課件-高中美術人教版(2019)美術鑒賞
- [康熙字典9畫五行屬金的字加解釋] 康熙字典五行屬金的字
- 托盤操作評分表
- 關于老年癡呆癥及其智能陪護設備的調查報告
- 椴木靈芝栽培技術
評論
0/150
提交評論