大数据基础技能试题及答案Word文件下载.docx
《大数据基础技能试题及答案Word文件下载.docx》由会员分享,可在线阅读,更多相关《大数据基础技能试题及答案Word文件下载.docx(35页珍藏版)》请在冰豆网上搜索。
homedirectory"
Stringt=s-"
directory"
5.Whicharesyntacticallyvalidstatementati=m;
B.i=b;
C.i=;
D.i=(30);
E.i=.
6.Whichlayoutmanagerisusedwhentheframeisresizedthebuttons'
spositionintheFramemightbechanged
A.BorderLayout
B.FlowLayout
C.CardLayout
D.GridLayout
7.Giventhefollowingcodefragment:
1)publicvoidcreate(){
2}VectormyVect;
3}myVect=newVector();
4}}
Whichofthefollowingstatementsaretrue
A.Thedeclarationonline2doesnotallocatememoryspaceforthevariablemyVect.B.Thedeclarationonline2allocatesmemoryspaceforareferencetoaVector
object.
C.Thestatementonline2createsanobjectofclassVector.
D.Thestatementonline3createsanobjectofclassVector.
E.Thestatementonline3allocatesmemoryspaceforanobjectofclassVector
8.Whichofthefollowingansweriscorrecttoexpressthevalue8inoctalnumber
A.010
B.0x10
C.08
D.0x8
9.WhicharenotJavakeywords
A.TRUEB.sizeofC.constD.superE.void
10.Whichofthefollowingstatementsaretrue
A.Theequals()methoddeterminesifreferencevaluesrefertothesameobject.
B.The==operatordeterminesifthecontentsandtypeoftwoseparate
objects
match.
C.Theequals()methodreturnstrueonlywhenthecontentsoftwoobjectsmatch.
D.TheclassFileoverridesequals()toreturntrueifthecontents
andtype
of
two
separateobjectsmatch.
11.Whichstatementsaboutinheritancearetrue
A.InJavaprogramminglanguageonlyallowssingleinheritance.
B.InJavaprogramminglanguageallowsaclasstoimplementonlyoneinterface.
C.InJavaprogramminglanguageaclasscannotextendaclassandimplementainterfacetogether.
D.InJavaprogramminglanguagesingleinheritancemakescodemorereliable.
12.
1)classPerson{
2}publicvoidprintValue(inti,intj){/*⋯*/}
3}publicvoidprintValue(inti){/*...*/}
5)publicclassTeacherextendsPerson{
6}publicvoidprintValue(){/*...*/}
7}publicvoidprintValue(inti){/*...*/}
8}publicstaticvoidmain(Stringargs[]){
9}Persont=newTeacher();
10}(10);
11}}
12}}
Whichmethodwillthestatementonline10call
A.online2
B.online3
C.online6
D.online7
13.WhicharenotJavaprimitivetypesA.short
B.BooleanC.unit
D.float
14、Themethodresume()isresponsibleforresumingwhichthread'
sexecution
A.Thethreadwhichisstoppedbycallingmethodstop()
B.Thethreadwhichisstoppedbycallingmethodsleep()
D.Thethreadwhichisstoppedbycallingmethodsuspend()
15.Whichofthefollowingrangeofintiscorrect
A.-2^7
–2^7-1
B.0–2^32-1
C.-2^15
–2^15-1
D.-2^31
–2^31-1
16.WhichkeywordshouldbeusedtoenableinteractionwiththelockofanobjectTheflagallowsexclusiveaccesstothatobject.
A.transient
B.synchronized
C.serialize
D.static
17.Whichisthereturntypeofthemethodmain()A.int
B.void
C.booleanD.static
18.Giventhefollowingcode:
if(x>
0){"
first"
);
}
elseif(x>
-3){"
second"
else{"
third"
Whichrangeofxvaluewouldprintthestring"
A.x>
0
B.x>
-3
C.x<
=-3
D.x<
=0&
x>
19、Whichofthefollowingansweriscorrecttoexpressthevalue10inhexadecimalnumber
A.0xA
B.0x16
C.0A
D.016
20.Whichstatementsaboutthegarbagecollectionaretrue
A.Theprogramdevelopermustcreateathreadtoberesponsibleforfreethememory.
B.Thegarbagecollectionwillcheckforandfreememorynolongerneeded.C.Thegarbagecollectionallowtheprogramdevelopertoexplicityandimmediatelyfreethememory.
D.Thegarbagecollectioncanfreethememoryusedjavaobjectatexpecttime.
21、Giventhefollowingcode:
1)publicclassTest{2}intm,n;
3}publicTest(){}
4}publicTest(inta){m=a;
5}publicstaticvoidmain(Stringarg[]){
6}Testt1,t2;
7}intj,k;
8}j=0;
k=0;
9}t1=newTest();
10}t2=newTest(j,k);
Whichlinewouldcauseoneerrorduringcompilation
A.line3
B.line5
C.line6
D.line10
22、Giventheuncompletedcodeofaclass:
classPerson{
Stringname,department;
intage;
publicPerson(Stringn){name=n;
publicPerson(Stringn,inta){name=n;
age=a;
publicPerson(Stringn,Stringd,inta){
."
partoftheconstructor
A.Person(n,a);
B.this(Person(n,a));
C.this(n,a);
D.this(name,age).
23、WhichofthefollowingstatementsaboutvariablesandtheirscopesaretrueA.Instancevariablesaremembervariablesofaclass.
B.Instancevariablesaredeclaredwiththestatickeyword.
C.Localvariablesdefinedinsideamethodarecreatedwhenthemethodisexecuted.
D.Localvariablesmustbeinitializedbeforetheyareused.
24、publicvoidtest(){
try{oneMethod();
"
condition1"
}catch(ArrayIndexOutOfBoundsExceptione){
condition2"
}catch(Exceptione){"
condition3"
}finally{
finally"
}
WhichwilldisplayifoneMethodrunnormally
A.condition1
B.condition2
C.condition3
D.finally
25、Giventhefollowingcode:
publicclassTest{
voidprintValue(intm){
do{"
Thevalueis"
+m);
while(--m>
10)
publicstaticvoidmain(Stringarg[]){
inti=10;
Testt=newTest();
(i);
Whichwillbeoutput
A.Thevalueis8
B.Thevalueis9
C.Thevalueis10
D.Thevalueis11
26、Whichofthefollowingstatementsaboutdeclarationaretrue
A.Declarationofprimitivetypessuchasboolean,byteandsoondoesnotallocatememoryspaceforthevariable.
B.Declarationofprimitivetypessuchasboolean,byteandsoonallocatesmemoryspaceforthevariable.
C.DeclarationofnonprimitivetypessuchasString,Vectorandsoondoesnot
allocatememoryspacefortheobject.
D.DeclarationofnonprimitivetypessuchasString,Vectoranssoonallocatesmemoryspacefortheobject.
27、IntheJavaAPIdocumentationwhichsectionsareincludedinaclassdocument
A.Thedescriptionoftheclassanditspurpose
B.Alistofmethodsinitssuperclass
C.Alistofmembervariable
D.Theclasshierarchy
28、Giventhefollowingcode:
1)publicvoidmodify(){
2)inti,j,k;
3)i=100;
4)while(i>
0){
5)j=i*2;
6)("
Thevalueofjis"
+j);
7)k=k+1;
8)i--;
9)}
10}}
Whichlinemightcauseanerrorduringcompilation
A.line4
B.line6
C.line7
D.line8
29、Whichofthefollowingstatementsaboutvariablesandscopearetrue
A.Localvariablesdefinedinsideamethodaredestroyedwhenthemethodisexited.
B.Localvariablesarealsocalledautomaticvariables.
C.Variablesdefinedoutsideamethodarecreatedwhentheobjectisconstructed.
D.Amethodparametervariablecontinuestoexistforaslongastheobjectis
neededinwhichthemethodisdefined.
30、Aclassdesignrequiresthatamembervariablecannotbeaccessibledirectlyoutsidetheclass.Whichmodifiershouldbeusedtoobtaintheaccesscontrol
A.public
B.nomodifier
C.protected
D.private
31、Giventhefollowingcodefragment:
1)Stringstr=null;
2)if((str!
=null)&
&
()>
10)){3}"
morethan10"
5)elseif((str!
()<
5)){
6}"
lessthan5"
7}}
8)else{"
end"
Whichlinewillcauseerror
A.line1
B.line2
C.line5
32、WhichstatementsaboutJavacodesecurityaretrue
A.Thebytecodeverifierloadsallclassesneededfortheexecutionofaprogram.
B.Executingcodeisperformedbytheruntimeinterpreter.
C.Atruntimethebytecodesareloaded,checkedandruninaninterpreter.
D.Theclassloaderaddssecuritybyseparatingthenamespacesfortheclasses
ofthelocalfilesystemfromthoseimportedfromnetworksources.
33、Giventhefollowingcode:
publicclassPerson{
intarr[]=newint[10];
publicstaticvoidmain(Stringa[]){
Whichstatementiscorrect
A.Whencompilationsomeerrorwilloccur.
B.Itiscorrectwhencompilationbutwillcauseerrorwhenrunning.
C.Theoutputiszero.
D.Theoutputisnull.
34、publicclassParent{
publicintaddValue(inta,intb){
ints;
s=a+b;
returns;
classChildextendsParent{
WhichmethodscanbeaddedintoclassChild
A.intaddValue(inta,intb){.}
B.publicvoidaddValue(){.}
C.publicintaddValue(inta){.}
D.publicintaddValue(inta,intb)throwsMyException{.}
35、Whichstatementsaboutthreadaretrue
A.Onceathreadiscreated,itcanstarrunningimmediately.
B.Tousethestart()methodmakesathreadrunnable,
butitdoesnotnecessarily
startimmediately.
C.Whenathreadstopsrunningbecauseofpre-emptive,
it
isplacedatthefront
endoftherunnablequeue.
D.Athreadmayceasetobereadyforavarietyofreasons.
36、Amembervariabledefinedinaclasscanbeaccessedonlybytheclassesinthe
samepackage.Whichmodifiershouldbeusedtoobtaintheaccesscontrol
A.private
C.public
D.protected
37、ApublicmembervairablecalledMAX_LENGTHwhichisinttype,thevalueofthevariableremainsconstantvalue