金蝶中间件校招笔试题Word文档下载推荐.docx
《金蝶中间件校招笔试题Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《金蝶中间件校招笔试题Word文档下载推荐.docx(19页珍藏版)》请在冰豆网上搜索。
D.(i.equals(d))
E.(d.equals(l))
F.(i.equals(l))
G.(l.equals(42L))
3.Whathappenswhenyoutrytocompileandrunthefollowingapplication?
Chooseall
Correctoptions.
1.publicclassZ{
2.publicstaticvoidmain(String[]args){
3.newZ();
4.}
5.
6.Z(){
7.Zalias1=this;
8.Zalias2=this;
9.synchronized(alias1){
10.try{
11.alias2.wait();
12.System.out.println("
DONEWAITING"
);
13.}
14.catch(InterruptedExceptione){
15.System.out.println("
INTERRUPTED"
16.}
17.catch(Exceptione){
18.System.out.println("
OTHEREXCEPTION"
19.}
20.finally{
21.System.out.println("
FINALLY"
22.}
23.}
24.System.out.println("
ALLDONE"
25.}
26.}
A.Theapplicationcompilesandprints“DONEWAITING”
B.Theapplicationcompilesbutdoesn’tprintanything
C.Theapplicationcompilesandprint“FINALLY”
D.Theapplicationcompilesandprint“ALLDONE”
E.Theapplicationcompilesandprint“INTERRUPTED”
F.Theapplicationcompilesandprint“DONEWAITING”and“FINALLY”
4.Considerthefollowingclasses:
1.classPerson{
2.publicvoidprintValue(inti,intj){/*.....*/}
3.publicvoidprintValue(inti){/*....*/}
5.publicclassTeacherextendsPerson{
6.publicvoidprintValue(){/*...*/}
7.publicvoidprintValue(inti){/*...*/}
8.publicvoidprintValue(Stringi){/*...*/}
9.publicstaticvoidmain(Stringargs[]){
10.Persont=newTeacher();
11.charch='
y'
;
12.t.printValue(ch);
13.}
14.}
Whichofthestatementsbelowistrue?
A.Line7willnotcompile,becausevoidmethodscannotbeoverridden
B.Line12willnotcompile,becausethereisnoversionofprintValue()thattakesacharargument
C.Thecodewillcompilebutwillthrowanexceptionatline12atruntime
D.Thestatementonline12willinvokethemethodonline8
E.Thestatementonline12willinvokethemethodonline2
F.Thestatementonline12willinvokethemethodonline3
G.Thestatementonline12willinvokethemethodonline7
5.Considerthefollowingstatement,chooseallcorrectoptions
YouaregivenaclasshierarchywithaninstanceoftheClassDog.TheclassDogisachildof
MammalandtheclassMammalisachildoftheclassVertebrate.TheclassVertebratehasamethodcalledmovewhichprintsoutthestring“move”.TheclassMammaloverridesthismethodandprintsoutthestring”walks”.TheclassDogoverridesthismethodandprintsoutthestring“walksonpaws”.
Givenaninstance(dog)oftheclassDog,howcanyouaccesstheancestormethodmoveinVertebratesoitprintsoutthestring“move”;
A.dog.super().super().move();
B.dog.parent().parent().move();
C.dog.move();
D.noneoftheabove
6.Whatwillhappenwhenyouattempttocompileandrunthefollowingcode.
publicclassTest{
publicstaticvoidmain(Stringargv[]){
HHQht=newHHQ("
myname"
ht.start();
}
}
classHHQextendsThread{
privateStringname="
"
HHQ(Strings){
name=s;
publicvoidrun(){
inner();
System.out.println("
finished"
publicvoidinner(){
while(true){
try{
System.out.println("
waiting"
wait();
}catch(InterruptedExceptionie){
}
System.out.println(name);
notifyAll();
}
A.Itwillcauseacompiletimeerror
B.Compilationandoutputof“waiting”
C.Compilationandoutputof“waiting”followedby“finished”
D.Runtimeerror,outputof“waiting”andanexceptionwillbethrown
7.Whichofthefollowingmostcloselydescribestheprocessofoverriding?
A.Aclasswiththesamenamereplacesthefunctionalityofaclassdefinedearlierinthehierarchy
B.Amethodwiththesamenamecompletelyreplacesthefunctionalityofamethodearlierinthehierarchy
C.Amethodwiththesamenamebutdifferentparametersgivesmultipleusesforthesamemethodname
D.Aclassispreventedfromaccessingmethodsinitsimmediateancestor
8.Giventhefollowingcode:
1classA{
2publicvoidprocess(){System.out.print("
A"
}}
3classBextendsA{
4publicvoidprocess()throwsIOException{
5super.process();
6System.out.print("
B"
7thrownewIOException();
8}
9publicstaticvoidmain(String[]args){
10try{
11newB().process();
12}catch(IOExceptione){
13System.out.println("
Exception"
14}
15}
16}
Whatwillhappenwhenyouattempttocompileandrunit?
A.Theprogramwillrunandoutput“A”,”B”and“Exception”
B.Theprogramwillrunandoutput“A”
C.Theprogramwillrunandoutput“B”and“Exception”
D.Compilationfa