SSD3单选.docx
- 文档编号:9584426
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:31
- 大小:35KB
SSD3单选.docx
《SSD3单选.docx》由会员分享,可在线阅读,更多相关《SSD3单选.docx(31页珍藏版)》请在冰豆网上搜索。
SSD3单选
1.1.1
1.ThenameofaJavasourcefile(d)
(a)mustbethesameastheclassitdefines,ignoringcase
(b)mustusetheextension.class
(c)hasnorestrictions
(d)mustbethesameastheclassitdefines,respectingcase
2.WhichmethodmustexistineveryJavaapplication?
(a)
(a)main
(b)paint
(c)init
(d)begin
1.1.3
1.Giventhefollowingcode,howmanytokenswillbeoutput?
(b)
StringTokenizerst=newStringTokenizer("thisisatest");
while(st.hasMoreTokens()){
stdOut.println(st.nextToken());
}
(a)1(b)4(c)0(d)3
2.ClassesfromwhichofthefollowingpackagesareimplicitlyimportedintoeveryJavaprogram?
(d)
(a)java.awt
(b)java.io
(c)java.util
(d)java.lang
3.Whatisthenameofthewrapperclassforthetypeint?
(d)
(a)integer
(b)Int
(c)INT
(d)Integer
4.ClassesfromwhichofthefollowingpackagesareimplicitlyimportedintoeveryJavaprogram?
(c)
(a)java.util
(b)java.awt
(c)java.lang
(d)java.io
5.Thetermwrapperclassesrefersto(a)
(a)acollectionofJavaclassesthat"wrap"Javaprimitivetypes
(b)theJavaclassesthatcontainatleasttwodatafields
(c)theJavaclassesthatcontainthemselves
(d)acollectionofJavaclassesthatcontainotherJavaclasses
6.WhatwillbeoutputcausedbytheexecutionofthefollowingJavaprogramsegment?
(c)
Stringname="Elvis";
System.out.print(name+"washere");
(a)name+washere
(b)Elviswashere
(c)Elviswashere
(d)namewashere
1.1.4
1.WhatwillbeoutputwhenthefollowingJavaprogramsegmentisexecuted?
(c)
intx=5;
inty=2;
System.out.println(x+y);
(a)52
(b)5+2
(c)7
(d)52
2.Adifferencebetweenthemethodsprintandprintlnoftheclassjava.io.PrintWriteristhat(a)
(a)printlnappendsanewlinetotheendofitsoutput,butprintdoesnot
(b)printappendsanewlinetotheendofitsoutput,butprintlndoesnot
(c)printlninsertsanewlineatthebeginningofitsoutput,butprintdoesnot
(d)printinsertsanewlineatthebeginningofitsoutput,butprintlndoesnot
3.ConsiderthefollowingJavaprogramsegment.(c)
intx=5;
inty=2;
System.out.println(x+"1"+y);
Whichofthefollowingstatementsistrueabouttheprogramsegment?
(a)Theoutputcausedbythecodewillbe8.
(b)Theoutputcausedbythecodewillbe512.
(c)Theoutputcausedbythecodewillbe512.
(d)Thecodewillcauseacompilationerror.
1.1.5
1.AllJavaexceptionclassesarederivedfromtheclass(a)
(a)java.lang.Throwable
(b)java.lang.Error
(c)java.lang.RuntimeException
(d)java.io.IOException
2.InJava,exceptionsthatarenothandledarepassedupthe(b)
(a)exceptionladder
(b)callstack
(c)blockhierarchy
(d)catchblocks
3.WhatistherightwaytohandleabnormalitiesininputonJava?
(d)
(a)Bywritingwhileloopstoguardagainstbadinput
(b)ByalwaysspecifyingthethrowsclauseineverymethodheaderwherefileI/Oisperformed
(c)ByusingtheclassFileFilterwhichgracefullyfiltersoutbadinputdata
(d)Byhandlingtheseproblemsbyprovidingexceptionhandlers
4.ConsiderthefollowingJavaprogramsegment.
importjava.io.*;
publicclassSomeClass{
publicvoidx(){
thrownewRuntimeException("Exceptionfromx");
}
publicvoidy(){
thrownewIOException("Exceptionfromy");
}
}
Whichofthefollowingistrueconcerningthedefinitionsforthemethodsxandy?
(a)
(a)xhasalegaldefinition,butyhasanillegaldefinition.
(b)xhasanillegaldefinition,butyhasalegaldefinition.
(c)Neitherxnoryhasalegaldefinition.
(d)Bothxandyhavelegaldefinitions.
1.1.6
1.WhichofthefollowingstatementsistrueoftheconventionsoutlinedbySunMicrosystemsinthedocumententitledCodeConventionsfortheJavaProgrammingLanguage?
(d)
TheydefineastandardinterfacedefinitionlanguagethatmustbeusedforallJavaclasses.
Theyproviderecommendationsintendedtomakesourcecodeeasiertoreadandunderstand.
TheydescribeonemechanismfornetworkcommunicationbetweenJavaandC++programs.
(a)IIIonly
(b)IandIIIonly
(c)I,II,andIII
(d)IIonly
Feedback:
Seesection1.1.6,subsection"CodeConvTOC"andsection1.1,subsection"WhyHaveCodeConventions,"inthecoursenotes.
2.AccordingtotheJavacodeconventions,filesthatcontainJavasourcecodehavethesuffix_____,andcompiledbytecodefileshavethesuffix_____.(d)
(a).class,.javac
(b).javac,.class
(c).class,.java
(d).java,.class
Feedback:
Seesection1.1.6,subsection"CodeConvTOC"andsection2.1,subsection"FileSuffixes,"inthecoursenotes.
3.AccordingtothedocumententitledCodeConventionsfortheJavaProgrammingLanguage,filesuffixesusedbyJavasoftwareincludewhichofthefollowing?
(b)
.obj
.class
.h
(a)IandIIIonly
(b)IIonly
(c)IandIIonly
(d)IIandIIIonly
1.1.7
1.WhichofthefollowingpatternsofcharactersopensaJavadoccommentblock?
(b)
(a)/*
(b)/**
(c)**/
(d)//
1.1.8
1.Afteratypicaldebuggerencountersabreakpoint,theprogrammerusingthedebuggermayperformwhichofthefollowingactions?
(a)
Examinethevaluesofvariablesinthehaltedprogram
Executethecurrentline
Resumeexecutionofthehaltedprogram
(a)I,II,andIII
(b)IandIIonly
(c)Ionly
(d)IIIonly
2.Inatypicalsource-codedebugger,aprogrammercanseta_____tocauseaprogramtostopexecutingataparticularlineofcode.(c)
(a)testcase
(b)stacktrace
(c)breakpoint
(d)printstatement
3.Astacktraceis(b)
(a)alistofvariablesallocatedonaprogram'sstack
(b)asequenceofmethodcalls
(c)onlyavailablethroughatypicaldebugger'sstepintofeature
(d)afatalerrorthatcausesatypicaldebuggertoterminate
4.Atoolthatallowsprogrammerstoexecutelinesofaprogramonelineatatimeinordertohelplocatethesourceofaprogram'serrorsisknownasa(n)(b)
(a)stacktrace
(b)debugger
(c)scope
(d)exceptionhandler
1.1.
1.AccordingtoJavadocconvention,thefirstsentenceofeachJavadoccommentshouldbe(c)
(a)an@authortag
(b)an@versiontag
(c)asummarysentenceofthedeclaredentry
(d)theorderoflinesisnotimportant
Feedback:
Seeformoreinformation.
1.2.1
1.InaUMLclassdiagram'srepresentationofaclass,thetop,middle,andlowerrectangularcompartmentsrespectivelydescribethe_____oftheclass.(c)
(a)attributes,methods,andname
(b)attributes,methods,andconstants
(c)name,attributes,andmethods
(d)name,methods,andconstants
2.UMLclassdiagramscandescribewhichofthefollowing?
(b)
Theinternalstructureofclasses
Relationshipsbetweenclasses
(a)Ionly
(b)IandII
(c)None
(d)IIonly
1.2.2
1.ConsiderthefollowingUMLclassdiagram.
Accordingtothediagram,instancesoftheclassnamed_____havereferencestoinstancesoftheclassnamed_____.(a)
(a)A,B
(b)A,C
(c)B,A
(d)B,C
2.ConsiderthefollowingUMLclassdiagram.
Accordingtothediagram,whichofthefollowingstatementsistrue?
(a)
(a)ClassAiscomposedofoneinstanceofClassBandoneormoreinstancesofClassC.
(b)ClassBandClassCarebothsubclassesofClassA.
(c)ClassBhasaone-to-oneassociationwithClassAandaone-to-manyassociationwithClassC.
(d)ClassAandClassBeachcontainatleastonereferencetoaninstanceofClassC.
3.Abinaryassociationissaidtoexistbetweentwoclasseswhen(a)
(a)anobjectofoneclassrequiresanobjectoftheotherclass
(b)oneclassisasubtypeoftheotherclass
(c)anobjectofoneclassisinstantiatedinthesamemethodasanobjectoftheotherclass
(d)oneclassbelongstothesamepackageastheotherclass
4.Themultiplicityofanassociationbetweentwoclassesindicatesthenumberof(a)
(a)instancesofoneclassthatcanbeassociatedwithaninstanceoftheotherclass
(b)methodsofoneclassthatarecalledbytheotherclass
(c)methodsandvariablescommontobothclasses
(d)timesthatoneclass'smethodsarecalledbytheotherclass
5.WhichofthefollowingistrueaboutassociationandaggregationinUMLclassdiagrams?
(c)
(a)Associationisaspecialformofaggregation.
(b)Associationistheoppositeofaggregation.
(c)Aggregationisaspecialformofassociation.
(d)Associationandaggregationhavenomeaningfulrelationship.
1.2.3
1.Acollectiontypicallymodelsa_____relationship.(b)
(a)many-to-many
(b)one-to-many
(c)zero-to-one
(d)one-to-one
2.ConsiderthefollowingUMLclassdiagram.(c)
Thediagramdescribesa
(a)relationshipbetweenasubclassandasuperclass
(b)one-to-onerelationship
(c)self-containingclass
(d)classwithoutmethods
3.Considertheclassdescribedbythefollowingdiagram:
Iftheclassrepresentsanemployeeandthebossattributereferstotheemployee'sboss,whichofthefollowingstatementsis(are)true?
(c)
Manyemployeescanhavethesameboss.
Oneemployeecanhavemanybosses.
(a)IIonly
(b)None
(c)Ionly
(d)IandII
4.ConsiderthefollowingUMLclassdiagram.
Whichofthefollowingis(are)trueaboutthesystemdescribedbythediagram?
(d)
AninstanceofPicturecancontainacollectionofinstancesoftheclassShape.
AninstanceofShapecancontainacollectionofinstancesoftheclassPicture.
(a)IIonly
(b)IandII
(c)None
(d)Ionly
5.Ifaclasshasanassociationwithitself,thentheclasscontains(b)
(a)amethodthatcallsitself
(b)anattributethatreferencesanobjectofthesameclass
(
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SSD3