您当前位置: 唯学网 » 计算机等级考试培训 » 备考试题专题

计算机等级考试二级JAVA考试精选选择题(4)

来源:唯学网•教育培训(www.vixue.com)  【唯学网 • 中国教育电子商务平台】 加入收藏

2014年上半年(第39次)全国计算机等级考试将于2014年3月29日—31日举行,网上报名将于2014年2月18日开始。离2014年计算机等级考试还有近一个月的时间,参加计算机等级二级JAVA的考生,应该详细了解考试大纲,按照考试大纲进行复习。

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

A.public protected final int i;

B.abstract class Fl{…}

C.private double height;

D.double weight()

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

class Test{

public s,tatic void main(String args[]){

MyThread t=new MyThread();

t.displayOutput("t has been createD");

t.start();

}

}

Class MyThread extends Thread{

public void displayOutput(String s){

System.out.println(s);

}

public void run(){

displayOutput("t is running.");

}

}

A.t has been created.

B.t has been created. t is running.

C.t is running.

D.编译出错

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

public class Test{

public static void main(String args[]){

int d=101;

int b=220:

long a=321;

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

}

}

A.ArraylndexOutOfBoundsException

B.NumberFormatException

C.ArithmeticException

D.EOFExeeption

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

public class Test

{

public static void main(String args[])

{

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=true b=false B.fl=true b=false

b=true c=true b=true c=false

C.a=true b=true D.a=false b=false

b=true c=false b=true c=false

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

public class Test{

public static void main(String args[]){

int a,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.5 B.6

C.7 D.101

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

A.栈顶 B.栈底

C.栈端 D.栈尾

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

public class Test{

public static void main(String args[]){

int i=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

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

A.FlowLayout

B.BorderLayout

C.GridLayout

D.UpLayout

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

A.字节流

B.字符流

C.对象输出流

D.数据流

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

程序代码:

public class throwsExeeption{

static void Proc(intsel)

throws Arithmetic Exception,Array Index Out Of

Bounds Exception{

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

if(sel= =0){

System.OUt.println("noException caught");

return;

}

else if(sel= =l){

int iArray[]=newint[4];

iArray[1]=3;

}

}

public static void main(String args[]){

try{

Proe(O);

Proc(1);

}

catch(Array Index Out Of Bounds Exception e){

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

}

finally{

System.out.println("inProcfinally"):

}

}

}

执行结果:

In Situation 0

no Exception caught

in Proc finally

A.In Situation l

B.In Situation

C.with Catch

D.int iArray l

在计算机培训栏目中还有计算机等级考试培训 一级和三级的考试辅导资料,想获得更多的资料,请点击唯学网计算机培训栏目,祝考生能顺利通过考试。

0% (0)
0% (10)
已有条评论