(SCJP) Java 5 SCJP Questions
SCJP : Java 5 SCJP Questions
11 medium-hard mock exam questions from the
updated
K & B Java certification book, for Java 5 (coming soon). (Kathy
Sierra / Bert Bates)
Notes:
1) The real exam will tell you how many answers to choose from; we don't, because we want this quiz to be a little harder than the real exam.
2) The real exam contains drag and drop questions; we formatted question #9 to reflect the way a drag and drop question might be asked (but without the whole dragging and dropping part)
3) These questions are a good representation of the tone, style, difficulty, and content of the real exam. If you've taken earlier versions of the Sun Certified Java Programmer exam, you'll notice a big difference--a switch from "knowledge-based" questions that ask a specific question about a Java rule, to "performance-based" questions where you must analyze code and then apply your knowledge of Java to figure out what's going on. You'll find less language trivia (or API memorization) questions, and more that see if you know how the language really works. Also, the questions we've presented here are geared toward the new Tiger/Java 5 features.
4) You're right--there is some code on the exam that you'd be fired if you tried to write code like that on the job. The exam developers tried to reduce this as much as possible, but we want you to be prepared for the real thing.
5) The book includes explanations for the answers -- we didn't do that here because we haven't finished that part. These questions *have* been beta-tested, so we're fairly confident that the answers are correct... but you know how that goes. If you don't understand an answer, check the javaranch.com SCJP certification forum, where the questions are being discussed.There are no dumb questions, so please ask in the forums! But we (Kathy and Bert) are not able to answer individual questions online right now, so javaranch is your best place for answers.
5) We're working on the book update as fast as we can! It will shipping from Amazon in late September or early October. Sorry for the delay... good luck with your studies.
6) These questions are copyrighted 2005, Kathy Sierra & Bert Bates. Our publisher requires that we say that. You can point people here, and you can print them out and share them with others, but please do not reproduce them in another book or mock exam.
1. Given:
enum Horse {
PONY(10),
// insert code here
HORSE(15);
Horse(int hands) {
this.height = hands;
this.weight = hands * 100;
}
int height;
int weight;
int getWeight() { return weight; }
void setWeight(int w) { weight = w; }
}
class Stable {
public static void main(String [] hay) {
Horse h = Horse.ICELANDIC;
System.out.println(h.getWeight() + " " + h.height);
}
}
Which, inserted independently at '// insert code here', produces the
output:
800 13 ? (Choose all that apply.)
A). ICELANDIC(13) { weight = 800; },
B). ICELANDIC(13) { setWeight(800); },
C). ICELANDIC(13) { this.weight = 800; },
D). ICELANDIC(13) { public int getWeight() { return 800; } },
E). None of the above code will produce the specified output.
F). Because of other code errors, none of the above will compile.
2. Given:
1. class Voop {
2. public static void main(String [] args) {
3. doStuff(1);
4. doStuff(1,2);
5. }
6. // insert code here
7. }
Which, inserted at line 6, will compile? (Choose all
that apply.)
A). static void doStuff(int... doArgs) { }
B). static void doStuff(int[] doArgs) { }
C). static void doStuff(int doArgs...) { }
D). static void doStuff(int... doArgs, int y) { }
E). static void doStuff(int x, int... doArgs) { }
F). None of the above code fragments will compile.
[Read
More..]
Courtesy:- Wickedlysmart.com
- guru's blog
- Login to post comments
