Sun Certified Programmer Practice Exam
Sun Certified Programmer Practice Exam
by Barry Boone
Email: ???
For
as long as it will be there you' ll find the original document
here.
I made a copy and you'll find it in the following section.
Here are the rules:
Allow 2 hours and 15 minutes to complete this exam. You should turn off the telephone, go someplace you won’t be disturbed, check the time on your watch, and begin. Don’t bring any books with you, because you won’t have them during the test. You can take breaks, but don’t look anything up. You can have a piece of scratch paper and a pen or pencil, but you can’t have any crib sheets!
If you get 49 questions right, you’ve hit the 70% mark, and you’ve passed. Good luck!
Question 1: Which of the following class definitions defines a legal abstract class?
Select all right answers.
a)
class Animal { abstract void growl(); } |
abstract Animal {abstract void growl();} |
class abstract Animal {abstract void growl();} |
abstract class Animal {abstract void growl();} |
abstract class Animal {abstract void growl() {System.out.println("growl");}} |
Question 2: For an object to be a target for a Thread, that object must be of type:
Fill in the blank.
Question 3: What is the proper way of defining a class named Key so that it cannot be subclassed?
a)
class Key { } |
abstract final class Key { } |
native class Key { } |
class Key {final;} |
final class Key { } |
Question 4: What modes are legal for creating a new RandomAccessFile object?
Select all valid answers.
Question 5: Given the following code:
class Tester {
cell.emergency(); class Phone { class CellPhone extends Phone { |
Question 6: Which assignments are legal?
Select all valid answers.
Question 7: Given this class definitions:
abstract class Transaction implements Runnable
{ }
class Deposit extends Transaction { void undo(int i) { |
Select the one right answer.
Question 8: Which exception might wait() throw?
Fill in the blank.
Question 9: Which of the following are not Java keywords:
abstract | double | int | static |
boolean | else | interface | super |
break | extends | long | superclass |
byte | final | native | switch |
case | finally | new | synchronized |
catch | float | null | this |
char | for | open | throw |
class | goto | package | throws |
close | if | private | transient |
const | implements | protected | try |
continue | import | public | void |
default | instanceof | return | volatile |
do | integer | short | while |
Select all valid answers.
Question 10: Which of the following represents an octal number?
Select all that apply.
Question 11: What will appear in the standard output when you run the Tester class?
class Tester {
int var; Tester(int var) { Tester(String s) { System.out.println(s); Tester() { public static void main(String[] args) { |
Question 12: Write a line of code to use the String’s substring() method to obtain the substring "lip" from a String instance named s that is set to "tulip".
Fill in the blank.
Question 13: There are a number of labels in the source code below. These are labeled a through j. Which label identifies the earliest point where, after that line has executed, the object referred to by the variable first may be garbage collected?
class Riddle {
String riddle; if (args.length < 2) return; a: first = new String(args[0]); b: second = new String(args[1]); c: riddle = "When is a " + first; d: first = null; e: riddle += " like a " + second + "?"; f: second = null; g: System.out.println(riddle); h: args[0] = null; i: args[1] = null; j: |
Question 14: What are the range of values for a variable of type byte?
Select the one right answer.
Question 15: What will happen when you try to compile and run the following program?
class Car {
int index; Car(int mpg) { index = 0; Car() { } public static void main(String[] args) { Car c = new Car(25); if (args.length > 0) |
Question 16: What will happen when you compile and run this program:
class Array {
int[] d = new int[length]; for (int index = 0; index < length; index++) |
Question 17: What is the result of attempting to compile and run the following class?
class Ar {
for (int i = 0; i < seeds.length; i++) |
Question 18: What method name can you use from the applet to read a String passed to an applet via the <param> tag? (Supply the method name only, without parameters.)
Fill in the blank.
Question 19: Given these class definitions:
class Superclass { }
class Subclass1 extends Superclass { } |
Superclass a = new Superclass();
Subclass1 b = new Subclass1(); |
a = b; |
Select the one right answer.
DISCLAIMER
|
|||
More is added to the list, but what I realy need is your help to keep this information up-to-date and may be it needs correcting in one way or the other. Please feel free to help me complement these question and answers drop us an email at this address. (C) 1998-2001, BMC88 - Personal WebSite of Java Certification Exams |
|||
|
||||