SSD3单选.docx

上传人:b****8 文档编号:9584426 上传时间:2023-02-05 格式:DOCX 页数:31 大小:35KB
下载 相关 举报
SSD3单选.docx_第1页
第1页 / 共31页
SSD3单选.docx_第2页
第2页 / 共31页
SSD3单选.docx_第3页
第3页 / 共31页
SSD3单选.docx_第4页
第4页 / 共31页
SSD3单选.docx_第5页
第5页 / 共31页
点击查看更多>>
下载资源
资源描述

SSD3单选.docx

《SSD3单选.docx》由会员分享,可在线阅读,更多相关《SSD3单选.docx(31页珍藏版)》请在冰豆网上搜索。

SSD3单选.docx

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 韩语学习

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1