2010计算机等级考试二级(JAVA)笔试61(三)

时间:2011-07-20 07:24:07

微信搜索关注"91考试网"公众号,领30元,获取事业编教师公务员等考试资料40G
1

C.2

D.3

参考答案: B

----------------------------------------

16、 给出下列的程序段,哪行在编译时可能会有错误? ( ) ①public void modify( ) ②int i,j,k; ③ i=100; ④ while(i>0){ ⑤ j=i*2; ⑥ System.out.println(The value of j is +j); ⑦ k=k+1; ⑧ } ⑨}

A.lie 4

B.lie 6

C.lie 7

D.lie 8

参考答案: C

----------------------------------------

17、 给出下列的程序段,哪个选项是不正确的? ( ) ①public void create(){ ②Vector my; ③my=new Vector(); ④}

A.第二行的声明不会为变量my分配内存空间

B.第二行语句创建一个Vector类对象

C.第三行语句创建一个Vector类对象

D.第三行语句为一个Vector类对象分配内存空间

参考答案: B

----------------------------------------

18、 有如下程序段 if(x>0){System.out.println(first);} else if(x>-4){System.out.println(second);{ else{System.out.println(third);} x的取值在什么范围内时,将打印出字符串“second”? ( )

A.x>0

B.x>-4

C.x<-4

D.x<0amamx>-4

参考答案: C

----------------------------------------

19、 给出下列代码,如何使成员变量m被方法fun()直接访问? ( ) class Test { private int m; public static void fun( ) { ... } }

A.将rivate it m改为rotected it m

B.将rivate it m改为ulic it m

C.将rivate it m改为tatic it m

D.将rivate it m改为it m

参考答案: C

----------------------------------------

20、 给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){name=n; age=a;} public Person(String n,String d,int a).{ department=d;______ } }

A.Pero(,a);

B.thi(Pero(,a).);

C.thi(,);

D.thi(ame,age);

参考答案: C

----------------------------------------

21、 给出下列的程序,其叙述正确的是 ( ) public class Man { static int arr[]=new int[10]; public static void mam(String a[]) { System.out.println(arr[1]); } }

A.编译时将发生错误

B.编译时正确但是运行时出错

C.输出为0

D.输出为ull

参考答案: C

----------------------------------------

22、 下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static vo

首页 上页 2 3 4 下页 尾页 3/5/5
微信搜索关注"91考试网"公众号,领30元,获取公务员事业编教师考试资料40G
【省市县地区导航】【考试题库导航】

电脑版  |  手机版  |  返回顶部