JAVA认证真题:SCJP认证套题解析(3)
来源:优易学  2011-11-28 10:37:25   【优易学:中国教育考试门户网】   资料下载   IT书店

 

57、Which of the following answer is correct to express the value 10 in hexadecimal number?
A. 0xA
B. 0x16
C. 0A
D. 016
(a)
题目:下面的哪些答案可以正确表示一个十六进制数字10。
十六进制数以0x开头,以0开头的是八进制数。十六进制表示中的a,b,c,d,e,f依次为10,11,12,13,14,15。

58、Which statements about thread are true?
A. Once a thread is created, it can star running immediately.
B. To use the start() method makes a thread runnable, but it does not necessarily start immediately.
C. When a thread stops running because of pre-emptive, it is placed at the front end of the runnable queue.
D. A thread may cease to be ready for a variety of reasons.
(bd)
题目:有关线程的哪些叙述是对的。
A.    一旦一个线程被创建,它就立即开始运行。
B.    使用start()方法可以使一个线程成为可运行的,但是它不一定立即开始运行。
C.    当一个线程因为抢先机制而停止运行,它被放在可运行队列的前面。
D.    一个线程可能因为不同的原因停止(cease)并进入就绪状态。
一个新创建的线程并不是自动的开始运行的,必须调用它的start()方法使之将线程放入可运行态(runnable state),这只是意味着该线程可为JVM的线程调度程序调度而不是意味着它可以立即运行。线程的调度是抢先式的,而不是分时间片式的。具有比当前运行线程高优先级的线程可以使当前线程停止运行而进入就绪状态,不同优先级的线程间是抢先式的,而同级线程间是轮转式的。一个线程停止运行可以是因为不同原因,可能是因为更高优先级线程的抢占,也可能是因为调用sleep()方法,而即使是因为抢先而停止也不一定就进入可运行队列的前面,因为同级线程是轮换式的,它的运行可能就是因为轮换,而它因抢占而停止后只能在轮换队列中排队而不能排在前面。

59、The method resume() is responsible for resuming which thread's execution?
A. The thread which is stopped by calling method stop()
B. The thread which is stopped by calling method sleep()
C. The thread which is stopped by calling method wait()
D. The thread which is stopped by calling method suspend()
(d)
题目:方法resume()负责恢复哪些线程的执行。
A.    通过调用stop()方法而停止的线程。
B.    通过调用sleep()方法而停止运行的线程。
C.    通过调用wait()方法而停止运行的线程。
D.    通过调用suspend()方法而停止运行的线程。
Thread的API文档中的说明是该方法恢复被挂起的(suspended)线程。该方法首先调用该线程的无参的checkAccess() 方法,这可能在当前线程上抛出SecurityException 异常,如果该线程是活着的(alive)但是被挂起(suspend),它被恢复并继续它的执行进程。

60、Given the following code:
1) public class Test {
2)    int m, n;
3)    public Test() {}
4)    public Test(int a) { m=a; }
5)    public static void main(String arg[]) {
6)       Test t1,t2;
7)       int j,k;
8)       j=0; k=0;
9)       t1=new Test();
10)       t2=new Test(j,k);
11)     }
12) }
Which line would cause one error during compilation?
A. line 3
B. line 5
C. line 6
D. line 10
(d)
题目:给出下面的代码:

在编译时哪行将导致一个错误。
第10行的声明调用一个带两个参数的Test的构造方法,而该类没有这样的构造方法。

上一页  [1] [2] [3] 

责任编辑:小草

文章搜索:
 相关文章
热点资讯
热门课程培训