浙大网新中研软件开发工程师笔试题.docx

上传人:b****7 文档编号:23810263 上传时间:2023-05-20 格式:DOCX 页数:13 大小:14.99KB
下载 相关 举报
浙大网新中研软件开发工程师笔试题.docx_第1页
第1页 / 共13页
浙大网新中研软件开发工程师笔试题.docx_第2页
第2页 / 共13页
浙大网新中研软件开发工程师笔试题.docx_第3页
第3页 / 共13页
浙大网新中研软件开发工程师笔试题.docx_第4页
第4页 / 共13页
浙大网新中研软件开发工程师笔试题.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

浙大网新中研软件开发工程师笔试题.docx

《浙大网新中研软件开发工程师笔试题.docx》由会员分享,可在线阅读,更多相关《浙大网新中研软件开发工程师笔试题.docx(13页珍藏版)》请在冰豆网上搜索。

浙大网新中研软件开发工程师笔试题.docx

浙大网新中研软件开发工程师笔试题

浙大网新中研软件开发工程师笔试题

 

选择题

 

1:

Considertheclasshierarchyshownbelow:

 

 

classFourWheelerimplementsDrivingUtilities

 

classCarextendsFourWheeler

 

classTruckextendsFourWheeler

 

classBusextendsFourWheeler

 

classCraneextendsFourWheeler

 

-

 

Considerthefollowingcodebelow:

 

1.DrivingUtilitiesdu;

 

2.FourWheelerfw;

 

3.TruckmyTruck=newTruck();

 

4.du=(DrivingUtilities)myTruck;

 

5.fw=newCrane();

 

6.fw=du;

 

Whichofthestatementsbelowaretrue?

 

Choices:

 

A.Line4willnotcompilebecauseaninterfacecannotrefertoanobject.

 

B.Thecodewillcompileandrun.

 

C.Thecodewillnotcompilewithoutanexplicitcastatline6,becausegoingdownthehierarchywithoutcastingisnotallowed.

 

D.Thecodewillcompileifweputanexplicitcastatline6butwillthrowanexceptionatruntime.

 

2:

Aclassdesignrequiresthatamembervariableshouldbeaccessibleonlybysamepackage,whichmodiferwordshouldbeused?

 

A.protected

 

B.public

 

C.nomodifer

 

D.private

 

3:

 

Whatistheresultwhenyoucompileandrunthefollowingcode?

 

publicclassThrowsDemo

 

{

 

staticvoidthrowMethod()

 

{

 

System.out.println(InsidethrowMethod.);

 

thrownewIllegalAccessException(demo);

 

}

 

publicstaticvoidmain(Stringargs[])

 

{

 

try

 

{

 

throwMethod();

 

}

 

catch(IllegalAccessExceptione)

 

{

 

System.out.println(Caught+e);

 

}

 

}

 

}

 

Choices:

 

Whatistheresultwhenyoucompileandrunthefollowingcode?

 

publicclassThrowsDemo

 

{

 

staticvoidthrowMethod()

 

{

 

System.out.println(InsidethrowMethod.);

 

thrownewIllegalAccessException(demo);

 

}

 

publicstaticvoidmain(Stringargs[])

 

{

 

try

 

{

 

throwMethod();

 

}

 

catch(IllegalAccessExceptione)

 

{

 

System.out.println(Caught+e);

 

}

 

}

 

}

 

Choices:

 

A.Compilationerror

 

B.Runtimeerror

 

C.Compilesuccessfully,nothingisprinted.

 

D.InsidethrowMethod.followedbycaught:

java.lang.IllegalAccessExcption:

demo

 

4:

 

Inthefollowingcode,whichistheearlieststatement,wheretheobjectoriginallyheldine,maybegarbagecollected:

 

1.publicclassTest{

 

2.publicstaticvoidmain(Stringargs[]){

 

3.Employeee=newEmployee(Bob,48);

 

4.e.calculatePay();

 

5.System.out.println(e.printDetails());

 

6.e=null;

 

7.e=newEmployee(Denise,36);

 

8.e.calculatePay();

 

9.System.out.println(e.printDetails());

 

10.}

 

11.}

 

OnlyOne:

 

Inthefollowingcode,whichistheearlieststatement,wheretheobjectoriginallyheldine,maybegarbagecollected:

 

1.publicclassTest{

 

2.publicstaticvoidmain(Stringargs[]){

 

3.Employeee=newEmployee(Bob,48);

 

4.e.calculatePay();

 

5.System.out.println(e.printDetails());

 

6.e=null;

 

7.e=newEmployee(Denise,36);

 

8.e.calculatePay();

 

9.System.out.println(e.printDetails());

 

10.}

 

11.}

 

OnlyOne:

 

A.Line10

 

B.Line11

 

C.Line7

 

D.Line8

 

5:

 

Whatwillbetheresultofexecutingthefollowingcode?

 

publicstaticvoidmain(Stringargs[])

 

{

 

chardigit=a

 

for(inti=0;ii++)

 

{

 

switch(digit)

 

{

 

casex:

 

{

 

intj=0;

 

System.out.println(j);

 

}

 

default:

 

{

 

intj=100;

 

System.out.println(j);

 

}

 

}

 

}

 

inti=j;

 

System.out.println(i);

 

}

 

Choices:

 

Whatwillbetheresultofexecutingthefollowingcode?

 

publicstaticvoidmain(Stringargs[])

 

{

 

chardigit=a

 

for(inti=0;ii++)

 

{

 

switch(digit)

 

{

 

casex:

 

{

 

intj=0;

 

System.out.println(j);

 

}

 

default:

 

{

 

intj=100;

 

System.out.println(j);

 

}

 

}

 

}

 

inti=j;

 

System.out.println(i);

 

}

 

Choices:

 

A.100willbeprinted11times.

 

B.Thecodewillnotcompilebecausethevariableicannotbedeclaredtwicewithinthemain()method.

 

C.Thecodewillnotcompilebecausethevariablejcannotbedeclaredtwicewithintheswitchstatement.

 

D.Noneofthese.

 

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

当前位置:首页 > 小学教育 > 其它课程

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

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