| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 761 人关注过本帖
标题:SCJP考试题310-025(第一套)
只看楼主 加入收藏
kingarden
Rank: 2
等 级:论坛游民
威 望:1
帖 子:517
专家分:40
注 册:2004-12-8
收藏
 问题点数:0 回复次数:0 
SCJP考试题310-025(第一套)
这是SCJP的考试原题,是1999-2000期间的!提供给想考SCJP的参考!
1. Which statement are characteristics of the >> and >>> operators.
A. >> performs a shift
B. >> performs a rotate
C. >> performs a signed and >>> performs an unsigned shift
D. >> performs an unsigned and >>> performs a signed shift
E. >> should be used on integrals and >>> should be used on floating
point types
C.
2. Given the following declaration
String s = "Example";
Which are legal code?
A. s >>> = 3;
B. s[3] = "x";
C. int i = s.length();
D. String t = "For " + s;
E. s = s + 10;
CDE.
3. Given the following declaration
String s = "hello";
Which are legal code?
A. s >> = 2;
B. char c = s[3];
C. s += "there";
D. int i = s.length();
E. s = s + 3;
CDE.
4. Which statements are true about listeners?
A. The return value from a listener is of boolean type.
B. Most components allow multiple listeners to be added.
C. A copy of the original event is passed into a listener method.
D. If multiple listeners are added to a single component, they all must
all be friends to each other.
E. If the multiple listeners are added to a single component, the order
[in which listeners are called is guaranteed].
BC.
5. What might cause the current thread to stop executing.
A. An InterruptedException is thrown.
B. The thread executes a wait() call.
C. The thread constructs a new Thread.
D. A thread of higher priority becomes ready.
E. The thread executes a waitforID() call on a MediaTracker.
ABDE.
6. Given the following incomplete method.
1. public void method(){
2.
3. if (someTestFails()){
4.
5. }
6.
7.}
You want to make this method throw an IOException if, and only if, the
method someTestFails() returns a value of true.
Which changes achieve this?
A. Add at line 2: IOException e;
B. Add at line 4: throw e;
C. Add at line 4: throw new IOException();
D. Add at line 6: throw new IOException();
E. Modify the method declaration to indicate that an object of [type]
Exception might be thrown.
CE.
7. Which modifier should be applied to a method for the lock of the
object this to be obtained prior to executing any of the method body?
A. final
B. static
C. abstract
D. protected
E. synchronized
E.
8. Which are keywords in Java?
A. NULL
B. true
C. sizeof
D. implements
E. instanceof
DE.
9. Consider the following code:
Integer s = new Integer(9);
Integer t = new Integer(9);
Long u = new Long(9);
Which test would return true?
A. (s==u)
B. (s==t)
C. (s.equals(t))
D. (s.equals(9))
E. (s.equals(new Integer(9))
CE.
10. Why would a responsible Java programmer want to use a nested class?
A. To keep the code for a very specialized class in close association
with the class it works with.
B. To support a new user interface that generates custom events.
C. To impress the boss with his/her knowledge of Java by using nested
classes all over the place.
AB.
11. You have the following code. Which numbers will cause "Test2" to be
printed?
switch(x){
case 1:
System.out.println("Test1");
case 2:
case 3:
System.out.println("Test2");
break;
}
System.out.println("Test3");
}
A. 0
B. 1
C. 2
D. 3
E. 4
BCD.
12. Which statement declares a variable a which is suitable for
referring to an array of 50 string objects?
A. char a[][];
B. String a[];
C. String []a;
D. Object a[50];
E. String a[50];
F. Object a[];
BCF.
13. What should you use to position a Button within an application
frame so that the width of the Button is affected by the Frame size but
the height is not affected.
A. FlowLayout
B. GridLayout
C. Center area of a BorderLayout
D. East or West of a BorderLayout
E. North or South of a BorderLayout
E.
14. What might cause the current thread to stop executing?
A. An InterruptedException is thrown
B. The thread executes a sleep() call
C. The thread constructs a new Thread
D. A thread of higher priority becomes ready (runnable)
E. The thread executes a read() call on an InputStream
ABDE.
Non-runnable states:
* Suspended: caused by suspend(), waits for resume()
* Sleeping: caused by sleep(), waits for timeout
* Blocked: caused by various I/O calls or by failing to get a monitor's
lock, waits for I/O or for the monitor's lock
* Waiting: caused by wait(), waits for notify() or notifyAll()
* Dead: Caused by stop() or returning from run(), no way out
15. Consider the following code:
String s = null;
Which code fragments cause an object of type NullPointerException to be
thrown?
A. if((s!=null) & (s.length()>0))
B. if((s!=null) &&(s.length()>0))
C. if((s==null) | (s.length()==0))
D. if((s==null) || (s.length()==0))
AC.
16. Given the following method body:
{
if (sometest()) {
unsafe();
}
else {
safe();
}
}
The method "unsafe" might throw an IOException (which is not a subclass
of RunTimeException). Which correctly completes the method of
declaration when added at line one?
A. public void methodName() throws Exception
B. public void methodname()
C. public void methodName() throw IOException
D. public void methodName() throws IOException
E. public IOException methodName()
AD.
17. What would be the result of attempting to compile and run the
following piece of code?
public class Test {
static int x;
public static void main(String args[]){
System.out.println("Value is " + x);
}
}
A. The output "Value is 0" is printed.
B. An object of type NullPointerException is thrown.
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.
E. An object of type ArrayIndexOutOfBoundsException is thrown.
A.
18. What would be the result of attempting to compile and run the
following piece of code?
public class Test {
public int x;
public static void main(String args[]){
System.out.println("Value is " + x);
}
}
A. The output "Value is 0" is printed.
B. Non-static variable x cannot be referenced from a static context..
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.
E. An object of type ArrayIndexOutOfBoundsException is thrown.
B.
19. What would be the result of attempting to compile and run the
following piece of code?
public class Test {
public static void main(String args[]){
int x;
System.out.println("Value is " + x);
}
}
A. The output "Value is 0" is printed.
B. An object of type NullPointerException is thrown.
C. An "illegal array declaration syntax" compiler error occurs.
D. A "possible reference before assignment" compiler error occurs.

E. An object of type ArrayIndexOutOfBoundsException is thrown.
D.
搜索更多相关主题的帖子: 考试 SCJP 
2005-01-09 19:21
快速回复:SCJP考试题310-025(第一套)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016698 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved