




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
SCJP認(rèn)證考試歷年真題
我在網(wǎng)上見(jiàn)到很多關(guān)于SCJP考試的說(shuō)法,很多人說(shuō)他簡(jiǎn)單!
確實(shí)是這樣的!但是這種說(shuō)法只是當(dāng)你拿到拿僅有的一套題
的時(shí)候,你可以這樣說(shuō)!有人說(shuō)他考的相當(dāng)全面,確實(shí)是這樣
的,當(dāng)你看到這一兩百套題給你的時(shí)候,你就會(huì)有此感悟!呵
呵!頭暈啊!它考的好多地方都是你在看資料的時(shí)候不留心
的地方你得不時(shí)的翻箱倒柜的找資料!這第2套題有147道
題,你可以將它收集起來(lái)!當(dāng)你留心看的時(shí)候,你的心就宛如
一團(tuán)亂麻,天那,這考的什么?想學(xué)真本事,就靜下心,仔細(xì)研
究吧!??!這是19-50題!
310-025
LeadingthewayinITtestingandcertificationtools,
www.testking.com
QuestionNo19
Given:
8.intindex=1;
9.boolean[]test=newBoolean[3];
10.booleanfoo=test[index];
Whatistheresult?
A.Foohasthevalueof0.
B.Foohasthevalueofnull.
C.Foohasthevalueoftrue.
D.Foohasthevalueoffalse.
E.Anexceptionisthrown.
F.Thecodewillnotcompile.
Answer:D
QuestionNo20
Given:
1.publicclasstest(
2.publicstaticvoidmain(string[]args){
3.stringfoo=args[1];
4.stringfoo=args[2];
5.stringfoo=args[3];
6.)
7.)
Andcommandlineinvocation:
JavaTestredgreenblue
Whatistheresult?
A.Bazhasthevalueof””
B.Bazhasthevalueofnul1
C.Bazhasthevalueof"red"
D.Bazhasthevalueof"blue"
E.Baxhasthevalueof“green”
F.Thecodedoesnotcompile.
G.Theprogramthrowsanexception.
Answer:G
QuestionNo21
Given:
8.intindex=1;
9.int[]foo=newint[3];
10.intbar=foo[index];
11.intbaz=bar+index;
Whatistheresult?
A.Bazhasthevalueof0
B.Bazhasthevalueof1
C.Bazhasthevalueof2
D.Anexceptionisthrown.
E.Thecodewillnotcompile.
Answer:B
QuestionNo22
Given:
1.publicclassfoo{
2.publiestaticvoidmain(String[]args)
3.Strings;
4.system.out.printin("s="+s);
5.}
6.)
Whatistheresult?
A.Thecodecompilesand“s=”isprinted.
B.Thecodecompilesand“s=null”isprinted.
C.Thecodedoesnotcompilebecausestringsisnot
initialized.
D.Thecodedoesnotcompilebecausestringscannot
bereferenced.
E.Thecodecompiles,butaNullPointerExceptionis
thrownwhentoStringiscalled.
Answer:C
QuestionNo23
Whichwilldeclareamethodthatforcesasubclassto
implementit?
A.PublicdoublemethodaO;
B.Staticvoidmethoda(doubledl){}
C.PublicnativedoublemethodaO;
D.AbstractpublicvoidmethodaO;
E.Protectedvoidmethoda(doubledl){}
Answer:D
QuestionNo24
Youwantsubclassesinanypackagetohaveaccessto
membersofasuperclass.Whichisthemost
restrictiveaccessmodifierthatwillaccomplishthis
objective?
A.Public
B.Private
C.Protected
D.Transient
E.Noaccessmodifierisqualified
Answer:C
QuestionNo25
Given:
1.abstractclassabstrctlt{
2.abstractfloatgetFloat();
3.)
4.publicclassAbstractTestextendsAbstractlt{
5.privatefloatfl=1.Of;
6.privatefloatgetFloat(){returnfl;}
7.)
Whatistheresult?
A.Compilationissuccessful.
B.Anerroronline6causesaruntimefailure.
C.Anerroratline6causescompilationtofail.
D.Anerroratline2causescompilationtofail.
Answer:C
QuestionNo26
Exhibit:
1.publicclasstest(
2.publicintaMethod()[
3.staticinti=0;
4.i++;
5.returnI;
6.)
7.publiestaticvoidmain(Stringargs[]){
8.testtest=newtest();
9.test.aMethod();
10.intj=test.aMethod();
11.System,out.printin(j);
12.]
13.}
Whatistheresult?
A.Compilationwillfail.
B.Compilationwillsucceedandtheprogramwillprint
ar\”
C.Compilationwillsucceedandtheprogramwillprint
“],,
D.Compilationwillsucceedandtheprogramwillprint
“2”
Answer:D
QuestionNo27
Given:
1.classsuper{
2.publicfloatgetNumO{return3.Of;}
3.)
4.
5.publieclassSubextendsSuper{
6.
7.)
Whichmethod,placedatline6,willcauseacompiler
error?
A.PublicfloatgetNumO{return4.Of;}
B.PublicvoidgetNum(){}
C.PublicvoidgetNum(doubled){}
D.PublicdoublegetNum(floatd){retrun4.Of;}
Answer:B
QuestionNo28
Whichdeclarationpreventscreatingasubclassofan
outerclass?
A.StaticclassFooBar{}
B.PrivateclassFooBar{}
C.AbstractpublicclassFooBar{}
D.FinalpublicclassFooBar{}
E.FinalabstractclassFooBar{}
Answer:D
QuestionNo29
Given:
1.byte口arryl,array2[];
2.bytearray3[]口;
3.byte[][]array4;
Ifeacharrayhasbeeninitialized,whichstatement
willcauseacompilererror?
A.Array2=array1;
B.Array2:array3;
C.Array2=array4;
D.BothAandB
E.BothAandC
F.BothBandC
Answer:F
QuestionNo30
Exhibit:
1.classsuper(
2.publieint1=0;
3.
4.publicsuper(stringtext)(
5.I=1
6.)
7.)
8.
9.publicclasssubextendssuper(
10.publicsub(stringtext)(
11.i=2
12.)
13.
14.publicstaticvoidmain(straingargs[])(
15.subsub=newsub("Hello");
16.system,out.Printin(sub.i);
17.)
18.)
Whatistheresult?
A.Compilationwillfail.
B.Compilationwillsucceedandtheprogramwillprint
“0”
C.Compilationwillsucceedandtheprogramwillprint
a],,
D.Compilationwillsucceedandtheprogramwillprint
“2”
Answer:A
QuestionNo31
Given:
1.publicclassreturnlt(
2.returnTypemethodA(bytex,doubley)(
3.return(short)x/y*2;
4.)
5.)
WhatisthevalidreturnTypeformethodAinline2?
A.Int
B.Byte
C.Long
D.Short
E.Float
F.Double
Answer:F
QuestionNo32
GiventheActionEvent,whichmethodallowsyouto
identifytheaffectedcomponent?
A.GetClass.
B.GetTarget.
C.GetSource.
D.GetComponent.
E.GetTargetComponent.
Answer:C
QuestionNo33
WhichisamethodoftheMouseMotionListenerinterface?
A.PublicvoidmouseMoved(MouseEvent)
B.PublicbooleanmouseMoved(MouseEvent)
C.PublicvoidmouseMoved(MouseMotionEvent)
D.PublicbooleanMouseMoved(MouseMotionEvent)
E.PublicbooleanmouseMoved(MouseMotionEvent)
Answer:A
QuestionNo34
Exhibit:
1.importjava,awt*;
2.
3.publicclassXextendsFrame(
4.publicstaticvoidmain(string[]args)(
5.Xx=newX();
6.X.pack();
7.x.setVisible(true);
8.)
9.
10.publicX()(
11.setlayout(newGridLayout(2,2));
12.
13.Panelpl=newpanel();
14.Add(pl);
15.Buttonbl=newButton(“One”);
16.Pl.add(bl);
17.
18.Panelp2=newpanel();
19.Add(p2);
20.Buttonb2=newButton("Two”);
21.P2.add(b2);
22.
23.Buttonb3=newButton("Three");
24.add(b3);
25.
26.Buttonb4=newButton(“Four”);
27.add(b4);
28.)
29.)
Whichtwostatementsaretrue?(ChooseTwo)
A.Allthebuttonschangeheightiftheframeheight
isresized.
B.AllthebuttonschangewidthiftheFramewidthis
resized.
C.Thesizeofthebuttonlabeled"One”isconstant
eveniftheFrameisresized.
D.Bothwidthandheightofthebuttonlabeled“Three”
mightchangeiftheFrameisresized.
Answer:C,D
QuestionNo35
Youareassignedthetaskofbuildingapanelcontaining
aTextAreaatthetop,alabeldirectlybelowit,
andabuttondirectlybelowthelabel.Ifthethree
componentsareaddeddirectlytothepanel.Which
layoutmanagercanthepanelusetoensurethatthe
TextAreaabsorbsallofthefreeverticalspacewhen
thepanelisresized?
A.GridLayout.
B.CardLayout.
C.FlowLayout.
D.BorderLayout.
E.GridBagLayout.
Answer:E
QuestionNo36
Whichgetsthenameoftheparentdirectoryfile
“file,txt”?
A.Stringname=File.getParentName("file.txt");
B.Stringname=(newFile("file.txt")).getParent();
C.Stringname=(new
File(“file,txt")).getParentName();
D.Stringname二(new
File("file,txt")).getParentFile();
E.Directorydir=(newFile
(file,txtv)).getParentDir();
Stringname=dir.getName();
Answer:B
QuestionNo37
WhichcanbeusedtoencodecharSforoutput?
A.Java.io.Outputstream.
B.Java.io.OutputStreamWriter.
C.Java.io.EncodeOutputStream.
D.Java.io.EncodeWriter.
E.Java.io.BufferedOutputStream.
Answer:B
QuestionNo38
Thefile“file.txt“existsonthefilesystemand
contsinsASCIItext.
Given:
38.try{
39.Filef=newFile("file.txt");
40.OutputStreamout-newFileOutputStream(f,true);
41.)
42.catch(lOException){}
Whatistheresult?
A.Thecodedoesnotcompile.
B.Thecoderunsandnochangeismadetothefile.
C.Thecoderunsandsetsthelengthofthefileto0.
D.Anexceptionisthrownbecausethefileisnotclosed.
E.Thecoderunsanddeletesthefilefromthefile
system.
Answer:A
QuestionNo39
WhichconstructsaDataOutputStream?
A.NewdataOutputStream("out.txt");
B.NewdataOutputStream(newfile("out.txt"));
C.NewdataOutputStream(newwriter("out.txt"));
D.NewdataOutputStream(newFileWriter("out.txt"));
E.NewdataOutputStream(new
OutputStream("out.txt"));
F.NewdataOutputStream(new
FileOutputStream("out.txt"));
Answer:F
QuestionNo40
Whatwritesthetext""totheendofthefile
“file,txt”?
A.OutputStreamout=newFileOutputStream
(“file,txt");
Out.writeBytes("/n”);
B.OutputStreamos=newFileOutputStream("file.txt”
true);
DataOutputStreamout=newDataOutputStream(os);
out.writeBytes("/n");
C.OutputStreamos=newFileOutputStream
("file,txt");
DataOutputStreamout=newDataOutputStream(os);
out.writeBytes("/n”);
D.OutputStreamos=newOutputStream("file.txt”,
true);
DataOutputStreamout=newDataOutputStream(os);
out.writeBytes("/n");
Answer:B
QuestionNo41
Given:
1.publicclassX(
2.publicobjectm(){
3.objecto=newfloat(3.14F);
4.object[]oa=newobject[1];
5.oa[0]=o;
6.o=null;
7.returnoa[0];
8.)
9.)
Whenisthefloatobjectcreatedinline3,eligible
forgarbagecollection?
A.Justafterline5
B.Justafterline6
C.Justafterline7(thatis,asthemethodreturns)
D.Neverinthismethod.
Answer:D
QuestionNo42
Given:
3.stringfoo="ABCDE”;
4.foo.substring(3);
5.foo.concat("XYZ”);
6.
Typethevalueoffooatline6.
Answer:ABCDE
QuestionNo43
Whichmethodisanappropriatewaytodeterminethe
cosineof42degrees?
A.Doubled=Math,cos(42);
B.Doubled=Math.cosine(42);
C.Doubled=Math,cos(Math.toRadians(42));
D.Doubled=Math,cos(Math.toDegrees(42));
E.Doubled=Math,cosine(Math.toRadians(42));
Answer:C
QuestionNo44
Youneedtostoreelementsinacollectionthat
guaranteesthatnoduplicatesarestoredandall
elements
canbeaccessedinnaturalorder.Whichinterface
providesthatcapability?
A.Java.util.Map.
B.Java.util.Set.
C.Java.util.List.
D.Java.util.StoredSet.
E.Java.util.StoredMap.
F.Java.util.Collection.
Answer:D
QuestionNo45
Whichstatementistruefortheclassjava.util.HashSet?
A.Theelementsinthecollectionareordered.
B.Thecollectionisguaranteedtobeimmutable.
C.Theelementsinthecollectionareguaranteedtobe
unique.
D.Theelementsinthecollectionareaccessedusing
auniquekey.
E.Theelementsinthecollectionsareguaranteedto
besynchronized.
Answer:C
QuestionNo46
Given:
1.publicclassIfTest(
2.publicstaticvoidmain(string[]args){
3.intx=3;
4.inty=1;
5.if(x=y)
6.system,out.println("Notequal");
7.else
8.system.out.printin("Equal");
9.)
10.)
Whatistheresult?
A.Theoutputis“Equal”
B.Theoutputin“NotEqual"
C.Anerroratline5causescompilationtofall.
D.Theprogramexecutesbutdoesnotprintamessage.
Answer:C
QuestionNo47
Exhibit:
1.publicclasstest(
2.publicstaticvoidmain(stringargs[])
3.int1=0;
4.while(i){
5.if(i==4){
6.break;
7.)
8.++i;
9.)
10.
11.)
12.)
Whatisthevalueofiat1ine10?
A.0
B.3
C.4
D.5
E.Thecodewillnotcompile.
Answer:E
QuestionNo48
Given:
3.inti=1,j=10;
4.do(
5.if(i++>-j)continue;
6.)while(i<5);
Afterexecution,whatarethevaluesforIandj?
A.i=6andj=5
B.i=5andj=5
C.i=6andj=4
D.i=5andj=6
E.i=6andj=6
Answer:D
QuestionNo49
Given:
1.switch(i){
2.default:
310-025
LeadingthewayinITtestingandcertificationtools,
www.testking.com
-27-
3.System,out.printin("Hello”);
4.)
Whatarethetwoacceptabletypesforthevariablei?
(ChooseTwo)
A.Char
B.Byte
C.Float
D.Double
E.Object
Answer:A,B
QuestionNo50
Given:
1.publicclassfoo{
2.publicstaticvoidmain(string[]args)
3.try{return;}
4.finally{system.out.println(^Finallyv);)
5.}
6.)
Whatistheresult?
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Finally”
C.Thecodecompiles,butanexceptionisthrownat
runtime.
D.Thecodewillnotcompilebecausethecatchblock
ismissing.
Answer:B
310-025
LeadingthewayinITtestingandcertificationtools,
QUESTIONNO:92
Given:
1.Stringfoo="blue”;
2.Boolean[]bar=newBoolean[1];
3.if(bar[0]){
4.foo="green”;
5.)
Whatistheresult?
A.Foohasthevalueofa
B.Foohasthevalueofnull.
C.Foohasthevalueof“blue”
D.Foohasthevalueof“green”
E.Anexceptionisthrown.
F.Thecodewillnotcompile.
Answer:F
QUESTIONNO:93
Exhibit:
1.publicclassX{
2.publicstaticvoidmain(String[]args){
3.Stringsi=newString("true");
4.Booleanbl=newBoolean(true);
5.if(s2.equals(bl)){
6.System.out.printin("Equal");
7.)
8.}
9.)
Whatistheresult?
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Equal”
C.Anerroratline5causescompilationtofail.
D.Theprogramrunsbutabortswithanexception.
Answer:A
QUESTIONNO:94
Given:
1.publicclassFoo{
2.publicstaticvoidmain(String[]args){
3.inti=1;
4.intj=i++;
5.if((i>++j)&&(i++=j)){
6.i+=j;
7.)
8.)
9.)
Whatisthefinalvalueofi?
A.1
B.2
C.3
D.4
E.5
Answer:B
QUESTIONNO:95
Exhibit:
1.publicclassX{
2.publicstaticvoidmain(String[]args)
3.strings=newstring("Heno”);
4.modify(s);
5.System,out.printin(s);
6.)
7.
8.publiestaticvoidmodify(Strings){
9.s+=“world!”;
10.}
11.)
Whatistheresult?
E.Theprogramrunsandprints“Hello”
F.Anerrorcausescompi1ationtofail.
G.Theprogramrunsandprints“Helloworld!”
H.Theprogramrunsbutabortswithanexception.
Answer:A
QUESTIONNO:96
Whichtwoareequivalent?(ChooseTwo)
A.16>4
B.16/2
C.16*4
D.16?2
E.16/2"2
F.16?>2
Answer:D,F
QUESTIONNO:97
Exhibit:
1.publicclassX{
2.publicstaticvoidmain(String[]args){
3.int□a=newint[1]
4.modify(a);
5.System.out.printin(a[0]);
6.)
7.
8.publicstaticvoidmodify(int[]a){
9.a[0]++;
10.}
11.}
Whatistheresult?
A.Theprogramrunsandprints“0”
B.Theprogramrunsandprints"1”
C.Theprogramrunsbutabortswithanexception.
D.Anerrorupossibleundefinedvariablevatline4
causescompilationtofail.
E.Anerrorupossibleundefinedvariablevatline9
causescompilationtofail.
Answer:B
QUESTIONNO:98
Given:
13.publicclassFoo{
14.publicstaticvoidmain(String口args){
15.StringBuffera=newStringBuffer("A”);
16.StringBufferb=newStringBuffer("B");
17.operate(a,b);
18.system.out.printin{a+“,”+b};
19.)
20.staticvoidoperate(StringBufferx,StringBuffer
y){
21.y.append{x};
22.y=x;
23.)
24.}
Whatistheresult?
A.Thecodecompilesandprints“A,B”.
B.Thecodecompilesandprints“A,BA”.
C.Thecodecompilesandprints“AB,B”.
D.Thecodecompilesandprints“AB,AB”.
E.Thecodecompilesandprints“BA,BA”.
F.Thecodedoesnotcompilebecause“+”cannotbe
overloadedforStringBuffer.
Answer:B
QUESTIONNO:99
Given:
1.publicclassX{
2.publicstaticvoidmain(String口args){
3.byteb=127;
4.bytec=126;
5.byted=b+c;
6.)
7.)
Whichstatementistrue?
A.Compilationsucceedsanddtakesthevalue253.
B.Line5containsanerrorthatpreventscompilation.
C.Line5throwsanexceptionindicating“Outof
range”
D.Line3and4containerrorthatpreventcompilation.
E.Thecompilationsucceedsanddtakesthevalueof
1.
Answer:B
QUESTIONNO:100
Given:
1.publicclassWhileFoo{
2.publiestaticvoidmain(String[]args){
3.intx=1,y=6;
4.while(y一){x一;}
5.system.out.printin("x="+x"y="+y);
6.)
7.)
Whatistheresult?
A.Theoutputisx=6y=0
B.Theoutputisx=7y=0
C.Theoutputisx=6y=-1
D.Theoutputisx=7y=-1
E.Compilationwillfail.
Answer:E
QUESTIONNO:101
Whichstatementistrue?
A.TheErrorclassisauntimeException.
B.NoexceptionsaresubclassesofError.
C.AnystatementthatmaythrowanErrormustbe
enclosedinatryblock.
D.AnystatementthatmaythrowanExceptionmustbe
enclosedinatryblock.
E.AnystatementthatmaythroaruntimeExceptionmust
beenclosedinatryblock.
Answer:D
QUESTIONNO:102
Exhibit:
1.int1=1,j=0
2.
3.switch(i){
4.case2:
5.j+=6;
6.
7.case4:
8.j+=l;
9.
10.default:
11.j+=2;
12.
13.case0:
14.j+=4;
15.}
16.
Whatisthevalueofjat1ine16?
A.0
B.1
C.2
D.4
E.6
Answer:AE
QUESTIONNO:103
Given:
1.switch(i){
2.default:
3.System.out.printin("Hello");
4.)
Whatistheacceptabletypeforthevariablei?
A.Byte
B.Long
C.Float
D.Double
E.Object
F.AandB
G.CandD
Answer:A
QUESTIONNO:104
Youneedtostoreelementsinacollectionthat
guaranteesthatnoduplicatesarestored.Whichtwo
interfacesprovidethatcapability?(ChooseTwo)
A.Java.util.Map
B.Java.util.Set
C.Java.util.List
D.Java.util.StoredSet
E.Java.util.StoredMap
F.Java.util.Collection
Answer:B,D
QUESTIONNO:105
Whichstatementistruefortheclass
java.util.ArrayList?
A.Theelementsinthecollectionareordered.
B.Thecollectionisguaranteedtobeimmutable.
C.Theelementsinthecollectionareguaranteedtobe
unique.
D.Theelementsinthecollectionareaccessedusing
auniquekey.
E.Theelementsinthecollectionsareguaranteedto
besynchronized.
Answer:A
QUESTIONNO:106
Exhibit:
1.publicclassXimplementsRunnable(
2.privateintx;
3.privateinty;
4.
5.publicstaticvoidmain(String[]args)
6.Xthat=newX();
7.(newThread(that)).start();
8.(newThread(that)).start();
9.)
10.
11.publicvoidrun()(
12.for(;;)(
13.x++;
14.y++;
15.System.out.printin("x="+x+”,y="+y);
16.)
17.)
18.)
Whatistheresult?
A.Errorsatlines7and8causecompilationtofail.
B.Theprogramprintspairsofvaluesforxandythat
mightnotalwaysbethesameonthesameline
(forexample,"x=2,y=1").
C.Theprogramprintspairsofvaluesforxandythat
arealwaysthesameonthesameline(for
example,"x=l,y=l”.Inaddition,eachvalueappears
twice(forexample,"x=l,y=l"followedby
“x=l,y=l").
D.Theprogramprintspairsofvaluesforxandythat
arealwaysthesameonthesameline(for
example,"x=l,y=l”.Inaddition,eachvalueappears
onlyforonce(forexample,"x=l,y=1"
followedby“x=2,y=2").
Answer:D
QUESTIONNO:107
Given:
1.publicclassSyncTest{
2.privateintx;
3.privateinty;
4.publicsynchronizedvoidsetX(inti)(x=l;)
5.publicsynchronizedvoidsetY(inti)(y=l;)
6.publicsynchronizedvoidsetXY(int1)(setX(i);
setY⑴;)
7.publicsynchronizedBooleancheck()(returnx!=y;)
8.)
Underwhichconditionswillcheck()returntruewhen
calledfromadifferentclass?
A.Check()canneverreturntrue.
B.Check()canreturntruewhensetXYiscalledby
multiplethreads.
C.Check()canreturntruewhenmultiplethreadscall
setXandsetYseparately.
D.Check()canonlyreturntrueifSyncTestischanged
toallowxandytobesetseparately.
Answer:A
QUESTIONNO:108
WhichisamethodoftheMouseMotionListenerinterface?
A.PublicvoidmouseDragged(MouseEvent)
B.PublicbooleanmouseDragged(MouseEvent)
C.PublicvoidmouseDragged(MouseMotionEvent)
D.PublicbooleanMouseDragged(MouseMotionEvent)
E.PublicbooleanmouseDragged(MouseMotionEvent)
Answer:A
QUESTIONNO:109
Given:
1.Stringfoo="base”;
2.foo.substring(0,3);
3.foo.concat("ket”);
4.foo+="ball”;
5.
Typethevalueoffooatline8.
Answer:BASEBALL
QUESTIONNO110
Given:
1.publicclassTest{
2.publicstaticvoidleftshift(inti,intj)
3.i?=j;
4.)
5.publicstaticvoidmain(Stringargs[]){
6.inti=4,j=2;
7.leftshift(i,j);
8.System,out.printin(i);
9.}
10.}
Whatistheresult?
A.2
B.4
C.8
D.16
E.Thecodewillnotcompile.
Answer:B
QUESTIONNO111
Given:
1.publieclassFoo{
2.privateintval;
3.publicfoo(intv)(val=v;)}
4.publicstaticvoidmain(String口args){
5.Fooa=newFoo(10);
6.Foob二newFoo(10);
7.Fooc=a;
8.intd=10;
9.doublee=10.0;
10.}
11.)
Whichthreelogicalexpressionevaluatetotrue?
(ChooseThree)
A.(a==c)
B.(d==e)
C.(b==d)
D.(a==b)
E.(b==c)
F.(d==10.0)
Answer:A,B,F
QUESTIONNO112
Exhibit:
1.publicclassX{
2.privatestaticinta;
3.
5.publicstaticvoidmain(String口args){
6.modify(a);
7.)
8.
9.publicstaticvoidmodify(inta){
10.a++;
11.)
12.}
Whatistheresult?
A.Theprogramrunsandprints“0”
B.Theprogramrunsandprints"1”
C.Theprogramrunsbutabortswithanexception.
D.Enerror“possibleundefinedvariablenatline5
causescompilationtofail.
F.Enerror“possibleundefinedvariable“atline10
causescompilationtofail.
Answer:A
QUESTIONNO113
Exhibit:
1.publicclassTest{
2.publicstaticvoidreplacej(stringtext){
3.text,replace(4F);
4.}
5.
6.publicstaticvoidmain(Stringargs[]){
7.stringtext=newString("java”)
8.replacej(text);
9.system,out.printin(text);
10.}
11.)
Whatistheresult?
A.Theprogramprints"lava”
B.Theprogramprints“java”
C.Anerroratline7causescompilationtofail.
D.Compilationsucceedsbuttheprogramthrowsan
exception.
Answer:B
QUESTIONNO114
Whichtwoareequivalent?(ChooseTwo)
A.3/2
B.3<2
C.3*4
D.3?2
E.3*2-2
F.3?<2
Answer:C,D
QUESTIONNO115
Whatisthenumericalrangeofachar?
A.0...32767
B.0...65535
C.-256...255
D.-32768...32767
E.Rangeisplatformdependent.
Answer:B
QUESTIONNO116
Given:
1.publicclassTest{
2.publiestaticvoidmain(String[]args){
3.unsignedbyteb=0;
4.b一;
5.
6.)
7.)
Whatisthevalueofbat1ine5?
A.-1
B.255
C.127
D.Compilationwillfail.
E.Compilationwillsucceedbuttheprogramwillthrow
anexceptionatline4.
Answer:D
QUESTIONNO117
Given:
1.publicclassFoo{
2.publicvoidmain(String[]args){
3.system.out.println(uHelloWorld.n;
4.}
5.}
Whatistheresult?
A.Anexceptionisthrown.
B.Thecodedoesnocompile.
C."HelloWorld."Isprintedtotheterminal.
D.Theprogramexitswithoutprintinganything.
Answer:A
QUESTIONNO118
Given:
1.//pointX
2.publicclassfoo(
3.publicstaticvoidmain(String[]args)throws
Exception{
4.java.io.printWriterout=newjava.io.PrintWriter
(
5.newjava.io.outputStreamWriter(System,out),true;
6.out.printin(^Hellov);
7.)
8.}
WhichstatementatPointXonline1allowsthiscode
tocompileandrun?
A.Importjava.io.*;
B.Includejava.io.
C.Importjava.io.PrintWriter;
D.Includejava.io.PrintWriter;
E.Nostatementisneeded.
Answer:E
QUESTIONNO119
Whichwilldeclareamethodthatisavailabletoall
membersofthesamepackageandcanbereferenced
withoutaninstanceoftheclass?
A.Abstractpublicvoidmethoda();
B.Publicabstractdoublemethoda();
C.Staticvoidmethoda(doubledl){}
D.Publicnativedoublemethoda(){}
E.Protectedvoidmethoda(doubledl){}
Answer:C
QUESTIONNO120
Whichtypeofeventindicatesakeypressedona
java.awt.Component?
A.KeyEvent
B.KeyDownEvent
C.KeyPressEvent
D.KeyTypedEvent
E.KeyPressedEvent
Answer:A
QUESTIONNO121
Exhibit:
1.importjava.awt.*;
2.
3.publicclassXextendsFrame{
4.publicstaticvoidmain(String口args){
5.Xx=newX();
6.x.pack();
7.x.setVisible(true);
8.}
9.
10.publicX(){
11.setLayout(newBordrLayout());
12.Panelp=newPanel();
13.add(p,BorderLayout.NORTH);
14.Buttonb=newButton("North");
15.p.add(b):
16.Buttonb=newButton("South");
17.add(bl,BorderLayout.SOUTH):
18.}
19.}
Whichtwostatementsaretrue?(ChooseTwo)
A.Thebuttonslabeled“North”and"South”will
havethesamewidth.
B.Thebuttonslabeled“North”and"South"will
havethesameheight.
C.Theheightofthebuttonlabeled“North“canvery
iftheFrameisresized.
D.Theheightofthebuttonlabeled“South”canvery
iftheFrameisresized.
E.Thewidthofthebuttonlabeled“North“isconstant
eveniftheFrameisresized.
F.Thewidthofthebuttonlabeled“South“isconstant
eveniftheFrameisresized.
Answer:B,E
QUESTIONNO122
Howcanyoucreatealistenerclassthatreceivesevents
whenthemouseismoved?
A.ByextendingMouseListener.
B.ByimplementingMouseListener.
C.ByextendingMouseMotionListener.
D.ByimplementingMouseMotionListener.
E.EitherbyextendingMouseMotionListener
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年電力行業(yè)年度策略報(bào)告:安徽省電力供需分析與展望
- 2024年湖南鴻峪建設(shè)工程有限公司招聘7人筆試參考題庫(kù)附帶答案詳解
- 2020浙教版高中信息技術(shù)2.3《網(wǎng)上資源檢索》教學(xué)設(shè)計(jì)
- 第15課 國(guó)共合作與北伐戰(zhàn)爭(zhēng) (教學(xué)設(shè)計(jì))八年級(jí)歷史上冊(cè)同步高效課堂(部編版)
- 第二章資源安全與國(guó)家安全大單元教學(xué)設(shè)計(jì)2023-2024學(xué)年高中地理人教版(2019)選擇性必修3
- 第五章發(fā)展與合作 教學(xué)設(shè)計(jì)2023-2024學(xué)年人教版地理七年級(jí)上冊(cè)
- 第一單元 探索生命的奧秘2023-2024學(xué)年七年級(jí)上冊(cè)生物同步教學(xué)設(shè)計(jì)(蘇教版)
- 教師職業(yè)道德與學(xué)前教育政策法規(guī) 教案 10. 第三節(jié)《幼兒園教師專業(yè)標(biāo)準(zhǔn)(試行)》解讀
- 柑橘交易中心建設(shè)項(xiàng)目可行性研究報(bào)告-柑橘產(chǎn)業(yè)規(guī)模擴(kuò)張交易需求日益旺盛
- Theme A Learning to Love Challenge Yourself A 教學(xué)設(shè)計(jì) -2024-2025學(xué)年高中英語(yǔ)重大版(2019)必修第二冊(cè)
- 云南普通初中學(xué)生成長(zhǎng)記錄-基本素質(zhì)發(fā)展初一-初三備課講稿
- 60萬(wàn)噸年磷石膏綜合利用項(xiàng)目資金申請(qǐng)報(bào)告模板定制
- 氣管切開(kāi)病人的護(hù)理查房PPT課件
- 小學(xué)五年級(jí)下冊(cè)綜合實(shí)踐活動(dòng).話說(shuō)節(jié)儉-(13張)ppt
- 日順電子酒店智能房控管理系統(tǒng)說(shuō)明書(shū)
- 急診與災(zāi)難醫(yī)學(xué)第二版配套課件 02 急性發(fā)熱
- 部編版四年級(jí)道德與法治下冊(cè)4《買東西的學(xué)問(wèn)》第1課時(shí)課件
- 公因數(shù)、最大公因數(shù)的應(yīng)用
- CBT主要技術(shù)精品課件
- 常用液壓元件型號(hào)對(duì)照表230
- 泰山產(chǎn)業(yè)領(lǐng)軍人才工程系統(tǒng)
評(píng)論
0/150
提交評(píng)論