ssd3选择题题库.docx
《ssd3选择题题库.docx》由会员分享,可在线阅读,更多相关《ssd3选择题题库.docx(13页珍藏版)》请在冰点文库上搜索。
ssd3选择题题库
SSD3选择题题库
methodmustexistineveryJavaapplication
(a)begin
(b)paint
(c)init
(d)main
Correctansweris(d)
2Whichofthefollowingisavalidcharacter
.literalinJava
(a)';'
(b)'<='
(c)"'"
(d)"a"
Correctanswer:
A
Javaidentifiermaybeginwithallbutwhichofthefollowing
(a)$
(b)if
(c)_(theunderscore)
(d)0
Correctansweris(d)
thecontextofJavaprogramming,garbagecollectionrefersto
(a)automaticbalancingofparenthesisperformedbysomeeditors
(b)removalofJavaprogramsthatcouldcausedamagetoasystem
(c)conversionofcommentsintoJavadoccomments
(d)automaticreturnofmemorytotheheapforobjectsnolongerrequiredbytheprogram
Correctansweris(d)
willbeoutputwhenthefollowingJavaprogramsegmentisexecuted
intx=5;
inty=2;
5+2
(b)52
(c)7
(d)52
Correctansweris(c)
5.Whichofthefollowingpartsofanif-else-statementisoptional
(a)theifpart
(b)theelsepart
(c)theparenthesisaroundthecondition
(d)thecondition
Correctansweris(b)
ofthefollowingistheJavaloopconstructtypicallyusedwhentherangeisclear
(a)while-loop
(b)for-loop
(c)switch-loop
(d)do-while-loop
Correctansweris(b)
thefollowingJavaprogramsegment.
import.*;
publicclassTest{
publicTest(){
"default");
}
publicTest(inti){
"non-default");
}
publicstaticvoidmain(String[]args){
Testt=newTest
(2);
}
}
Whichofthefollowingwillbeoutputduringexecutionoftheprogramsegment
(a)Thelineoftext"non-default"followedbythelineoftext"default"
(b)Thelineoftext"default"followedbythelineoftext"non-default"
(c)Thelineoftext"default"
(d)Thelineoftext"non-default"
Correctansweris(d)
isthenameoftheJDKprogramthatprocessesJavadoccomments
(a)java
(b)javac
(c)javacom
(d)javadoc
Correctansweris(d)
totheJavacodeconventions,fileslongerthanlinesshouldbe
(a)100,encouraged
(b)100,avoided
(c)2000,avoided
(d)2000,encouraged
Correctansweris(c)
primitivefloating-pointtypesavailableinJavaareand.
(a)real,double
(b)float,double
(c)real,float
(d)single,real
Correctansweris(b)
manybytesarerequiredtorepresentaUnicodecharacter
(a)Four
(b)One
(c)Three
(d)Two
Correctansweris(d)
manylinesofoutputwillbeproducedbythefollowingcodefragmentfor(inti=0;i<4;++i){
for(intj=1;j<3;++j){
(i+j);
(a)12
(b)6
(c)10
(d)8
Correctansweris(d)
manylinesofoutputwillbeproducedbythefollowingcodefragment
for(inti=0;i<3;++i){
for(intj=0;j
(i+j);
}}
(a)6
(b)4
(c)3
(d)5
Correctansweris(c)
ofthefollowingstatementsaboutclassvariablesinJavaisnottrue
(a)Classvariablesrequirethemodifierstaticinthedeclarations.
(b)
instantiated
inthesame
Allobjectshavetheirowncopyoftheclassvariabledefinedintheclass.
(c)Non-staticmethodsinaclasscanaccesstheclassvariabledefinedclass.
(d)Classvariablesdonotneedthereferencetotheobjectoftheinstantiatedclasstoaccessthem.
Correctansweris(b)
termclassvariableisasynonymfor
(a)aninstancevariable
(b)aread-onlyvariable
(c)aprivatedatafield
(d)astaticdatafield
Correctansweris(d)
ofthefollowingpatternsofcharactersopensaJavadoccommentblock
(a)/**
(b)
intx=5;
inty=2;
+"1"+y);
Whichofthefollowingstatementsistrueabouttheprogramsegment
(a)Theoutputcausedbythecodewillbe512.
(b)Theoutputcausedbythecodewillbe8.
(c)Thecodewillcauseacompilationerror.
(d)Theoutputcausedbythecodewillbe512.
Correctansweris(a)
thefollowingJavaprogramsegment.
import.*;
publicclassSomeClass{
publicvoidx(){
thrownewRuntimeException("Exceptionfromx");
}
publicvoidy(){
thrownewIOException("Exceptionfromy");
}
}
Whichofthefollowingistrueconcerningthedefinitionsforthemethodsxandy
(a)Neitherxnoryhasalegaldefinition.
(b)Bothxandyhavelegaldefinitions.
(c)xhasalegaldefinition,butyhasanillegaldefinition.
(d)xhasanillegaldefinition,butyhasalegaldefinition.
Correctansweris(c)
Java,exceptionsthatarenothandledarepassedupthe
(a)exceptionladder
(b)callstack
(c)catchblocks
(d)blockhierarchy
Correctansweris(b)
atypicaldebuggerencountersabreakpoint,theprogrammerusingthedebuggermayperformwhichofthefollowingactions
1.Examinethevaluesofvariablesinthehaltedprogram
2.Executethecurrentline
3.Resumeexecutionofthehaltedprogram
(a)IIIonly
(b)I,II,andIII
(c)Ionly
(d)IandIIonly
Correctansweris(b)
nameofaJavasourcefile
(a)mustusetheextension.class
(b)mustbethesameastheclassitdefines,respectingcase
(c)mustbethesameastheclassitdefines,ignoringcase
(d)hasnorestrictions
Correctansweris(b)
differencebetweenthemethodsprintandprintlnoftheclassisthat
(a)printlnappendsanewlinetotheendofitsoutput,butprintdoesnot
(b)printappendsanewlinetotheendofitsoutput,butprintlndoesnot
(c)printlninsertsanewlineatthebeginningofitsoutput,butprintdoesnot
(d)printinsertsanewlineatthebeginningofitsoutput,butprintlndoesnotCorrectansweris(a)
istherightwaytohandleabnormalitiesininputonJava
(a)Byhandlingtheseproblemsbyprovidingexceptionhandlers
(b)ByalwaysspecifyingthethrowsclauseineverymethodheaderwherefileI/O
isperformed
(c)ByusingtheclassFileFilterwhichgracefullyfiltersoutbadinputdata
(d)Bywritingwhileloopstoguardagainstbadinput
Correctansweris(a)
Javaexceptionclassesarederivedfromtheclass
(a)answeris(b)
ofthefollowingstatementsistrueoftheconventionsoutlinedbySunMicrosystemsinthedocumententitledCodeConventionsfortheJavaProgrammingLanguage
1.Theydefineastandardinterfacedefinitionlanguagethatmustbeusedforall
Javaclasses.
2.Theyproviderecommendationsintendedtomakesourcecodeeasiertoreadandunderstand.
3.TheydescribeonemechanismfornetworkcommunicationbetweenJavaandC++programs.
(a)IIIonly
(b)I,II,andIII
(c)IIonly
(d)IandIIIonly
Correctansweris(c)
toolthatallowsprogrammerstoexecutelinesofaprogramonelineatatimein
ordertohelplocatethesourceofaprogram'serrorsisknownasa(n)
(a)debugger
(b)stacktrace
(c)exceptionhandler
(d)scope
Correctansweris(a)
ofthefollowingisnottrueconcerningobjectsandtheirrepresentation
(a)objectsarerepresentedbytheiraddresses
(b)objectsarerepresentedbyvalue
(c)objectsarerepresentedbyreference
(d)objectsarerepresentedindirectly
Correctansweris(b)
programming,aloopisgenerallyusedtoachieve
(a)branching
(b)succession
(c)repetition
(d)selection
Correctansweris(c)
aclasscontainsaconstructor,thatconstructorwillbeinvoked
(a)eachtimeanobjectofthatclassgoesoutofscope
(b)onceatthebeginningofanyprogramthatusesthatclass
(c)oncethefirsttimeanobjectofthatclassisinstantiated
(d)eachtimeanobjectofthatclassisinstantiated
Correctansweris(d)ofthefollowingcategorizationscanbeappliedtoboththedatafieldsandthemethodsinaJavaclass
(a)nativeandnon-native
(b)staticandnon-static
(c)defaultandnon-default
(d)abstractandnon-abstract
Correctansweris(b)
10.AccordingtotheJavacodeconventions,filesthatcontainJavasourcecodehave
thesuffix,andcompiledbytecodefileshavethesuffix.
(a).javac,.class
(b).java,.class
(c).class,.javac
(d).class,.java
Correctansweris(b)
ofprimitivetypesarealsoreferredtoas
(a)references
(b)classes
(c)objects
(d)scalars
Correctansweris(d)
onthefollowingdeclaration,whatdoesb1representjustafterthedeclaration
isexecuted
Buttonb1;
(a)a"default"Buttonobject
(b)aButtonobjectwithnolabel
(c)ablankButtonobject
(d)nothing
Correctansweris(d)
8.Thereturntypeforamethodthatreturnsnothingtoitscalleris
(a)notspecifiedinthemethoddefinition
(b)false
(c)null
(d)void
Correctansweris(d)
isthenameofthewrapperclassforthetypeint
(a)Integer
(b)INT
(c)integer
(d)Int
Correctansweris(a)
(*)
3.Whichofthefollowingstatementsis(are)trueabouttheuseofanasteriskinaJavaimportstatement
Itdoesnotincurrun-timeoverhead.
Itcanbeusedtoimportmultiplepackageswithasinglestatement.
Itcanbeusedtoimportmultipleclasseswithasinglestatement.
(a)IIIonly
(b)IandIIIonly
(c)Ionly
(d)I,II,andIII
Correctansweris(b)
4.WhatwillbeoutputcausedbytheexecutionofthefollowingJavaprogramsegment
Stringname="Elvis";
+"washere");
(a)Elviswashere
(b)namewashere
(c)Elviswashere
(d)name+washere
Correctansweris(a)
10.AsanaidindebuggingaprograminJava,printstatementsmaybeusedtodisplaywhichofthefollowingtypesofinformation
Thenamesofmethodsbeingcalled
Thevaluesoftheparametersofamethod
Thevaluesoftheinstancevariablesofaclass
(a)IandIIonly
(b)I,II,andIII
(c)IIandIIIonly
(d)IandIIIonly
Correctansweris(b)
2.WhichpackagedoesnotneedtobeexplicitlyimportedintoaJavaprogram
(a)
(b)
(c)
(d)
Correctansweris(d)
1.
UMLclassdiagramscandescribewhichofthefollowing
Theinternalstructureofclasses
Relationshipsbetweenclasses
(a)None
(b)IIonly
(c)IandII
(d)Ionly
Correctansweris(c)
2.
InaUMLclassdiagram'srepresentationofaclass,thetop,middle,andlowerrectangularcompartmentsrespectivelydescribetheoftheclass.
(a)name,methods,andconstants
(b)name,attributes,andmethods
(b)attributes,methods,andname
(c)attributes,methods,andconstants
Correctansweris(b)