COOLCRAM Lab
JAVA Cram Bible
Sun Certified Programmer for the
Java 2 Platform
Exam 310-025
(Trail version)
WWW.COOLCRAM.COM
Copyright 1999-2000 COOL CRAM, All Rights Reserved.
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.
评论0