Java程序员认证模拟题及详细分析(1)

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Java程序员认证模拟题及详细分析(1)

一.说明:(真实考试)

1.考试形式:网络计算机

2.考题形式:多选,单选,简答

3.题量:60

4.考试时间:120分钟

二.模拟题

1.Which statement about the garbage collection mechanism are true?

A. Garbage collection require additional programe code in cases where multiple threads are running.

B. The programmer can indicate that a reference through a local variable is no longer of interest.

C. The programmer has a mechanism that explicity and immediately frees the memory used by Java objects.

D. The garbage collection mechanism can free the memory used by Java Object at explection time.

E. The garbage collection system never reclaims memory from objects while are still accessible to running user threads.

2. Give the following method:

1) public void method( ){

2) String a,b;

3) a=new String("hello world");

4) b=new String("game over");

5) System.out.println(a b "ok");

6) a=null;

7) a=b;

8) System.out.println(a);

9) }

In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.

A. before line 3

B.before line 5

C. before line 6

D.before line 7

E. Before line 9

3. In the class java.awt.AWTEvent,which is the parent class upon which jdk1.1 awt events are based there is a method called getID which phrase accurately describes the return value of this method?

A. It is a reference to the object directly affected by the cause of the event.

B. It is an indication of the nature of the cause of the event.

C. It is an indication of the position of the mouse when it caused the event.

D. In the case of a mouse click, it is an indication of the text under the mouse at the time of the event.

E. It tells the state of certain keys on the keybord at the time of the event.

F. It is an indication of the time at which the event occurred.

4. Which statement about listener is true?

A. Most component allow multiple listeners to be added.

B. If multiple listener be add to a single component, the event only affected one listener.

C. Component don?t allow multiple listeners to be add.

D. The listener mechanism allows you to call an addXxxxListener method as many times as is needed, specifying as many different listeners as your design require.

5.Give the following code:

public class Example{

public static void main(String args[] ){

int l=0;

do{

System.out.println("Doing it for l is:" l);

}while(--l>0)

System.out.println("Finish");

}

}

Which well be output:

A. Doing it for l is 3

B. Doing it for l is 1

C. Doing it for l is 2

D. Doing it for l is 0

E. Doing it for l is ?C1

F. Finish见1-5题答案

答案及详细分析:

1。B、E

JAVA的垃圾回收机制是通过一个后台系统级线程对内存分配情况进行跟踪实现的,对程序员来说是透明的,程序员没有任何方式使无用内存显示的、立即的被释放。而且它是在程序运行期间发生的。

答案B告诉我们程序员可以使一个本地变量失去任何意义,例如给本地变量赋值为"null";答案E告诉我们在程序运行期间不可能完全释放内存。

2。D

第6行将null赋值给a以后,a以前保存的引用所指向的内存空间就失去了作用,它可能被释放。所以对象a可能最早被垃圾回收是在第7行以前,故选择D选项。

3。B

请查阅JAVA类库。getID方法的返回值是"event type"。在认证考试中,总会有类似的书本以外的知识,这只能靠多实践来增长知识了。

4。A、D

控件可以同时使用多个"addXxxxListener"方法加入多个监听器。并且当多个监听器

相关文档
最新文档