您现在的位置:233网校>计算机二级>JAVA>模拟试题

2018年12月计算机二级Java考试冲刺题及答案(3)

来源:233网校 2018年12月2日

1.下列选项成员变量声明正确的是()。

A.publicprotectedfinalinti;

B.abstractclassFl{…}

C.privatedoubleheight;

D.doubleweight()

2.下面程序段的输出结果是()。

classTest{

publics,taticvoidmain(Stringargs[]){

MyThreadt=newMyThread();

t.displayOutput("thasbeencreateD");

t.start();

}

}

ClassMyThreadextendsThread{

publicvoiddisplayOutput(Strings){

System.out.println(s);

}

publicvoidrun(){

displayOutput("tisrunning.");

}

}

A.thasbeencreated.

B.thasbeencreated.tisrunning.

C.tisrunning.

D.编译出错

3.执行下列程序时,会产生什么异常()。

publicclassTest{

publicstaticvoidmain(Stringargs[]){

intd=101;

intb=220:

longa=321;

System.OUt.println((a-b)/(a-b-d));

}

}

A.ArraylndexOutOfBoundsException

B.NumberFormatException

C.ArithmeticException

D.EOFExeeption

4.下面程序段的输出结果为()。

publicclassTest

{

publicstaticvoidmain(Stringargs[])

{

booleana,b,C;

a=(3<5):

b=(a==true);

System.out.println("a="+a+"b="+b);

c=(b==false);

System.out.println("b="+b+"c="+c);

}

}

A.a=trueb=falseB.fl=trueb=false

b=truec=trueb=truec=false

C.a=trueb=trueD.a=falseb=false

b=truec=falseb=truec=false

5.下面程序段的输出结果是()。

publicclassTest{

publicstaticvoidmain(Stringargs[]){

inta,b;

for(a=1,b=1;a<=100;a++){

if(b>=10)break;

if(b%2==1){

b+=2:

continue;

}

}

System.OUt.println(a);

}

}

A.5B.6

C.7D.101

6.栈中允许进行插入和删除的一端称为()。

A.栈顶B.栈底

C.栈端D.栈尾

7.下面程序段的输出结果是()。

publicclassTest{

publicstaticvoidmain(Stringargs[]){

inti=1:

switch(i){

case0:

System.OUt.println("0");

break;

casel:

System.out.println("1");

case2:

System.OUt.println("2");

break;

default:

System.out.println("default");

}

}

}

A.01

B.12

C.10

D.21

8.Frame默认的布局管理器是()。

A.FlowLayout

B.BorderLayout

C.GridLayout

D.UpLayout

9.在Java语言中,ObjectOutputStream是指()。

A.字节流

B.字符流

C.对象输出流

D.数据流

10.请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是()。

程序代码:

publicclassthrowsExeeption{

staticvoidProc(intsel)

throwsArithmeticException,ArrayIndexOutOf

BoundsException{

System.out.println("InSituation"+sel);

if(sel==0){

System.OUt.println("noExceptioncaught");

return;

}

elseif(sel==l){

intiArray[]=newint[4];

iArray[1]=3;

}

}

publicstaticvoidmain(Stringargs[]){

try{

Proe(O);

Proc(1);

}

catch(ArrayIndexOutOfBoundsExceptione){

System.out.println("Catch"+e);

}

finally{

System.out.println("inProcfinally"):

}

}

}

执行结果:

InSituation0

noExceptioncaught

inProcfinally

A.InSituationl

B.InSituation

C.withCatch

D.intiArrayl

热点关注2018年12月计算机二级VB考试提分试题及答案汇总

领先备考:计算机讲师辅导,30小时高效提分,150元快速取证,马上试听>>

责编:cll