在线网课知慧《面向对象程序设计(山盟-齐工)》单元测试考核答案_第1页
在线网课知慧《面向对象程序设计(山盟-齐工)》单元测试考核答案_第2页
在线网课知慧《面向对象程序设计(山盟-齐工)》单元测试考核答案_第3页
在线网课知慧《面向对象程序设计(山盟-齐工)》单元测试考核答案_第4页
在线网课知慧《面向对象程序设计(山盟-齐工)》单元测试考核答案_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

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

文档简介

第一章单元测试1【单选题】(2分)WhicheditionofJavaisgearedtowarddevelopinglarge-scale,distributednetworkingapplicationsandweb-basedapplications?()A.EnterpriseEdition.B.StandardEdition.C.IndustrialEdition.D.MicroEdition.2【单选题】(2分)Javawasoriginallydevelopedfor:()A.Personalcomputers.B.Operatingsystemsdevelopment.C.Distributedcomputing.D.Intelligentconsumerdevices.3【单选题】(2分)WhichofthefollowingstatementsaboutJavaClassLibrariesisfalse:()A.JavaclasslibrariesarenotportableB.JavaclasslibrariesarealsoknownasJavaAPIs(ApplicationProgrammingInterfaces).C.AnadvantageofusingJavaclasslibrariesissavingtheeffortofdesigning,developingandtestingnewclasses.D.Javaclasslibrariesconsistofclassesthatconsistofmethodsthatperformtasks.4【单选题】(2分)The.classextensiononafilemeansthatthefile:()A.isproducedbytheJavacompiler(javac).B.Noneoftheabove.C.ContainsjavasourcecodeD.ContainsHTML5【单选题】(2分)Thecommand________executesaJavaapplication.()A.javacB.runC.javaD.Noneoftheabove第二章单元测试1【单选题】(2分)End-of-linecommentsthatshouldbeignoredbythecompileraredenotedusing()A.Threeforwardslashes(///).B.Aslashandastar(/*).C.Twoforwardslashes(//).D.Aslashandtwostars(/**).2【单选题】(2分)WhichofthefollowingisnotavalidJavaidentifier?()A.myValueB.m_xC.widthD.$_AAA13【单选题】(2分)WhichofthefollowingcannotcauseasyntaxerrortobereportedbytheJavacompiler?()A.Missing*/inacommentthatbeginswith/*B.Mismatched{}C.Missing;D.Anextrablankline.4【单选题】(2分)Whichofthefollowingdoesnotcontainasyntaxerror?()A.System.out.println("Helloworld!");B.System.out.println(Helloworld!);C.System.out.println('Helloworld!'):D.System.out.println("Hello回车换行world!");5【单选题】(2分)WhichcommandcompilestheJavasourcecodefileWelcome.java?()A.cdWelcome.javaB.javaWelcome.javaC.compileWelcome.javaD.javacWelcome.java6【单选题】(2分)WhichcommandexecutestheJavaclassfileWelcome.class?()A.javaWelcome.classB.javawelcomeC.javaWelcomeD.runWelcome.class7【单选题】(2分)Whichistheoutputofthefollowingstatements?()A.HelloWorldB.HelloWorldC.WorldHelloD.HelloWorld8【单选题】(2分)Whichstatementprintsthefloating-pointA.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);9【单选题】(2分)Whatisthesizeinbitsofanint?()A.32B.8C.64D.1610【单选题】(2分)Whichofthefollowingistheescapecharacter?()A.\nB.\C."D.*第三章单元测试1【单选题】(2分)Whichofthefollowingcanbeusedinaswitchstatementintheexpressionafterkeywordcase?a.aconstantintegralexpression.b.acharacterconstant.c.aStringd.anenumerationconstant.()A.All.B.bandcC.aandb.D.aandc2【单选题】(2分)Optionalparenthesesinexpressionsaresaidtobe()A.binaryoperators.B.implied.C.redundant.D.declared.3【单选题】(2分)WhichofthefollowingstatementsdoesnotaltertheA.number=12;B.y=y+2;C.inta;D.width=Integer.parseInt(input);4【单选题】(2分)WhatistheA.127B.119C.59D.515【单选题】(2分)Whichofthefollowingisnotanarithmeticoperator?()A.+B..C.%D.-6【单选题】(2分)Whichofthefollowingisnotacompilationerror?()A.Neglectingtoinitializealocalvariableinamethodbeforeitisused.B.Omittingtheleftandrightparenthesisfortheconditionofanifstatement.C.Allarecompilationerrors.D.Placingasemicolonattheendofthefirstlineofanifstatement.7【单选题】(2分)Eachofthefollowingisarelationalorequalityoperatorexcept:()A.B.<=C.==D.=!8【单选题】(2分)Whichofthefollowingisnotacontrolstructure:()A.Selectionstructure.B.Declarationstructure.C.Sequencestructure.D.Repetitionstructure.9【单选题】(2分)Whichstatementisfalse?()A.Unlessdirectedotherwise,thecomputerexecutesJavastatementsoneaftertheotherintheorderinwhichthey'rewritten.B.ActivitydiagramsnormallyshowtheJavacodethatimplementstheactivity.C.Thearrowsintheactivitydiagramrepresenttransitions,whichindicatetheorderinwhichtheactionsrepresentedbytheactionstatesoccur.D.Likepseudocode,activitydiagramshelpprogrammersdevelopandrepresentalgorithms.10【单选题】(2分)Whichofthefollowingisadouble-selectioncontrolstatement?()A.if…elseB.forC.do…whileD.if第四章单元测试1【判断题】Thenumberofargumentsinthemethodcallmustmatchthenumberofparametersinthemethoddeclaration’sparameterlist.()A.对B.错2【判断题】Floating-pointA.对B.错3【单选题】(2分)Eachclassyoucreatebecomesanew________thatcanbeusedtodeclarevariablesandcreateobjects.()A.type.B.instanceC.packageD.library4【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Eachclassdeclarationthatbeginswiththeaccessmodifierprivatemustbestoredinafilethathasthesamenameastheclassandendswiththe.javafilenameextension.B.Class,methodandvariablenamesareidentifiers.C.Anobjecthasattributesthatareimplementedasinstancevariablesandcarriedwithitthroughoutitslifetime.D.Everyclassdeclarationcontainskeywordclassfollowedimmediatelybytheclass’sname.5【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Byconventionclassnamesbeginwithanuppercaseletter,andmethodandvariablenamesbeginwithalowercaseletter.B.Instancevariablesexistbeforemethodsarecalledonanobject,whilethemethodsareexecutingandafterthemethodscompleteexecution.C.Aclassnormallycontainsoneormoremethodsthatmanipulatetheinstancevariablesthatbelongtoparticularobjectsoftheclass.D.Instancevariablescanbedeclaredanywhereinsideaclass.6【单选题】(2分)Whichofthefollowingstatementsistrue?()A.Mostinstance-variabledeclarationsareprecededwiththekeywordpublic,whichisanaccessmodifier.B.Noneoftheaboveistrue.C.Variablesormethodsdeclaredwithaccessmodifierprivateareaccessibleonlytomethodsoftheclassinwhichthey’redeclared.D.Eachobject(instance)oftheclasssharestheclass’sinstancevariables.7【单选题】(2分)Whenamethodterminates,theA.restoredB.lostC.savedD.copied8【单选题】(2分)Whichofthefollowingstatementsistrue?()A.ThedefaultB.EveryinstancevariablehasadefaultinitialC.Theargumenttypesinthemethodcallmustbeidenticaltothetypesofthecorrespondingparametersinthemethod’sdeclaration.D.Localvariablesareautomaticallyinitialized.9【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Thejavaccommandcancompilemultipleclassesatonce;simplylistthesource-codefilenamesafterthecommandwitheachfilenameseparatedbyacommafromthenext.B.Alloftheabovearetrue.C.Theasterisk(*)injavac*.javaindicatesthatallfilesinthecurrentdirectoryendingwiththefilenameextension.javashouldbecompiled.D.Ifthedirectorycontainingtheappincludesonlyoneapp’sfiles,youcancompileallofitsclasseswiththecommandjavac*.java.10【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.IntheUML,eachclassismodeledinaclassdiagramasarectanglewiththreecompartments.Thetoponecontainstheclass’snamecenteredhorizontallyinboldface.Themiddleonecontainstheclass’sattributes,whichcorrespondtoinstancevariablesinJava.Thebottomonecontainstheclass’soperations,whichcorrespondtomethodsandconstructorsinJava.B.UMLrepresentsinstancevariablesasanattributename,followedbyacolonandthetype.C.TheUMLmodelsoperationsbylistingtheoperationnamefollowedbyasetofparentheses.Aplussign(+)infrontoftheoperationnameindicatesthattheoperationisapublic.D.PrivateattributesareprecededbythekeywordprivateintheUML.11【判断题】Emptyparenthesesfollowingamethodnameinamethoddeclarationindicatethatthemethoddoesnotrequireanyparameterstoperformitstask.()A.对B.错12【判断题】Aprimitive-typevariablecanbeusedtoinvokeamethod.()A.对B.错13【判断题】Variablesdeclaredinthebodyofaparticularmethodareknownasinstancevariablesandcanbeusedinallmethodsoftheclass.()A.对B.错第五章单元测试1【判断题】Reference-typeinstancevariablesareinitializedbydefaulttotheA.对B.错2【判断题】Anyclassthatcontainspublicstaticvoidmain(String[]args)canbeusedtoexecuteanapp.()A.错B.对3【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Variablesdeclaredinthebodyofaparticularmethodarelocalvariablesandcanbeusedonlyinthatmethod.B.Everymethod’sbodyisdelimitedbyleftandrightbraces({and}).C.Amethod’sparametersarelocalvariablesofthemethod.D.Keywordnullindicatesthatamethodwillperformataskbutwillnotreturnanyinformation.4【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Emptyparenthesesfollowingamethodnameindicatethatthemethoddoesnotrequireanyparameterstoperformitstask.B.Whenamethodthatspecifiesareturntypeotherthanvoidiscalledandcompletesitstask,themethodmustreturnaresulttoitscallingmethodC.Themethod’sreturntypespecifiesthetypeofdatareturnedtoamethod’scaller.D.Classesoftenprovidepublicmethodstoallowtheclass’sclientstosetorgetprivateinstancevariables;thenamesofthesemethodsmustbeginwithsetorget.5【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Aclassinstancecreationexpressionbeginswithkeywordnewandcreatesanewobject.B.Scannermethodnextreadscharactersuntilanywhite-spacecharacterisencountered,thenreturnsthecharactersasaString.C.Tocallamethodofanobject,followtheobjectnamewithacomma,themethodnameandasetofparenthesescontainingthemethod’sarguments.D.Aconstructorissimilartoamethodbutiscalledimplicitlybythenewoperatortoinitializeanobject’sinstancevariablesatthetimetheobjectiscreated.6【单选题】(2分)Informationispassedtoamethodin________.()A.themethodbodyB.thatmethod’sreturnC.theargumentstothemethodD.themethodname7【单选题】(2分)Awell-designedmethod________.()A.performsasingle,well-definedtaskB.repeatscodefoundinothermethodsC.containsthousandsoflinesofcodeD.performsmultipleunrelatedtasks8【单选题】(2分)Todeclareamethodasstatic,placethekeywordstaticbefore________inthemethod’sdeclaration.()A.thereturntypeB.themethodnameC.theargumentlistD.themethodmodifier9【单选题】(2分)WhichisacorrectstaticmethodcallofMathclassmethodsqrt?()A.Mathmath=newMath();math.sqrt(900);B.math.sqrt(900);C.Math.sqrt(900);D.sqrt(900);10【单选题】(2分)WhichofthefollowingmethodsisnotintheMathclass?()A.ceilB.absC.logD.parseInt第六章单元测试1【单选题】(2分)MathstaticmethodrandomgeneratesarandomdoubleA.uptoandincluding1.0B.uptobutnotincluding100.0C.uptoandincluding100.0D.uptobutnotincluding1.02【单选题】(2分)WhichstatementcreatesarandomA.3+2*randomNumbers.nextInt(5);B.5+3*randomNumbers.nextInt(2);C.2+3*randomNumbers.nextInt(5);D.2+5*randomNumbers.nextInt(3);3【单选题】(2分)AsetofnamedconstantsthatstartwiththeA.enumerationB.classC.enumD.Noneoftheabove.4【单选题】(2分)Arraysare________.()A.usedtodrawasequenceoflines,orraysB.fixed-lengthentitiesC.variable-lengthentitiesD.datastructuresthatcontainupto10relateddataitems5【单选题】(2分)TypesinJavaaredividedintotwocategories.Theprimitivetypesareboolean,byte,char,short,int,long,floatanddouble.Allothertypesare________types.()A.declaredB.sourceC.staticD.reference6【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Primitive-typeinstancevariablesareinitializedbydefault.B.Variablesoftypesbyte,short,int,long,floatanddoubleareinitializedto0.C.Aprimitive-typevariablecanstoreexactlyoneD.Variablesoftypebooleanareinitializedtotrue.7【单选题】(2分)Whichofthefollowingstatementsaboutarraysaretrue?1:AnarrayisagroupofvariablescontainingA.1,2,4B.1,2,3,4C.1,3,4D.3,48【单选题】(2分)Aprogrammermustdothefollowingbeforeusinganarray:()A.declarethenreferencethearray.B.declarethencreatethearray.C.createthendeclarethearray.D.createthenreferencethearray.9【单选题】(2分)Considerthecodesegmentbelow.Whichofthefollowingstatementsisfalse?int[]g;g=newint[23];()A.TheB.gisareferencetoanarrayofintegers.C.Thefirststatementdeclaresanarrayreference.D.Thesecondstatementcreatesthearray.10【单选题】(2分)Whichofthefollowingstatementsaboutcreatingarraysandinitializingtheirelementsisfalse?()A.Whenanarrayiscreatedwithoperatornew,thenumberofelementsmustbeplacedinsquarebracketsfollowingthetypeofelementbeingstored.B.AforloopiscommonlyusedtosettheC.TheelementsofanarrayofintegershaveaD.Thenewkeywordshouldbeusedtocreateanarray.11【单选题】(2分)Whichofthefollowinginitializerlistswouldcorrectlysettheelementsofarrayn?()A.intn=newint(1,2,3,4,5);B.int[]n={1,2,3,4,5};C.intn[5]={1;2;3;4;5};D.arrayn[int]={1,2,3,4,5};第七章单元测试1【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Theclassfollowingtheextendskeywordinaclassdeclarationisthedirectsuperclassoftheclassbeingdeclared.B.Javausesinterfacestoprovidethebenefitsofmultipleinheritance.C.Asuperclassobjectisasubclassobject.D.Asubclassisoftenlargerthanitssuperclass.2【单选题】(2分)Inheritanceisalsoknownasthe()A.knows-arelationship.B.uses-arelationship.C.has-arelationship.D.is-arelationship.3【单选题】(2分)Whichofthefollowingisnotasuperclass/subclassrelationship?()A.Noneoftheabove.B.Sailboat/Tugboat.C.Vehicle/Car.D.Employee/HourlyEmployee.4【单选题】(2分)Anadvantageofinheritanceisthat:()A.Allmethodscanbeinherited.B.Objectsofasubclasscanbetreatedlikeobjectsoftheirsuperclass.C.Noneoftheabove.D.Allinstancevariablescanbeuniformlyaccessedbysubclassesandsuperclasses.5【单选题】(2分)Whichofthefollowingkeywordsallowsasubclasstoaccessasuperclassmethodevenwhenthesubclasshasoverriddenthesuperclassmethod?()A.base.B.super.C.this.D.public.6【单选题】(2分)Usingtheprotectedkeywordalsogivesamember:()A.privateaccess.B.publicaccess.C.packageaccess.D.blockscope.7【单选题】(2分)Superclassmethodswiththislevelofaccesscannotbecalledfromsubclasses.()A.protected.B.public.C.private.D.package.8【单选题】(2分)Whichofthefollowingstatementsisfalse?()A.Aclass'sinstancevariablesarenormallydeclaredprivatetoenforcegoodsoftwareengineering.B.Iftheclassyou'reinheritingfromdeclaresinstancevariablesasprivate,theinheritedclasscanaccessthoseinstancevariablesdirectly.C.It'softenmuchmoreefficienttocreateaclassbyinheritingfromasimilarclassthantocreatetheclassbywritingeverylineofcodethenewclassrequires.D.AclasscandirectlyinheritfromclassObject.9【单选题】(2分)EveryclassinJava,except________,extendsanexistingclass.()A.Object.B.String.C.Integer.D.Class.10【单选题】(2分)Overridingamethoddiffersfromoverloadingamethodbecause:()A.Overriddenmethodshavethesamesignature.B.Neitheroftheabove.C.Bothoftheabove.D.Overloadedmethodshavethesamesignature.第八章单元测试1【单选题】(2分)A(n)_____classcannotbeinstantiated.()A.polymorphic.B.abstract.C.concrete.D.final.2【单选题】(2分)Non-abstractclassesarecalled________.()A.instanceclasses.B.concreteclasses.C.implementableclasses.D.realclasses.3【单选题】(2分)Ifthesuperclasscontainsonlyabstractmethoddeclarations,thesuperclassisusedfor________.()A.Both.B.implementationinheritance.C.interfaceinheritance.D.Neither.4【单选题】(2分)Whichofthefollowingcouldbeusedtodeclareabstractmethodmethod1inabstractclassClass1(method1returnsanintandtakesnoarguments)?()A.publicintmethod1();B.publicabstractintmethod1();C.publicintabstractmethod1();D.publicintnonfinalmethod1();5【单选题】(2分)Whichofthefollowingstatementsaboutabstractsuperclassesistrue?()A.abstractsuperclassesmustdeclareallmethodsasabstract.B.abstractsuperclassesmustdeclarea

温馨提示

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

评论

0/150

提交评论