SCJP mock exam project
From Java.Inquisition
The aim of this project is to develop a free (in the open-source sense) set of revision questions / mock exam for the SCJP 5 certification that can be used with the Java.Inquisition exam engine. Please feel free to join in and contribute new questions, point out errors in current questions, or otherwise give feedback. You don't have to have passed the SCJP exam to contribute; helping out is one way to revise.
Number of questions at present: 20 (download Java.Inquisition to try them out).
Contents |
How to contribute a question
To write a new question, you can:
- use the Java.Inquisition exam editor
- write some raw XML, or
- post the question below in any format, and someone else will convert it into the Java.Inquisition format for you.
It should go without saying that you should not post other people's questions without permission (it's illegal, for a start).
Revision questions vs mock exam questions
A mock exam question is a question that closely approximates the questions on the real exam in every aspect (without, of course, being a real question). A revision question is a question that tests a point of knowledge needed for the exam, but differs either in difficulty, format or style of question. Revision questions are easier to write as you need only knowledge of the exam topics (which can be gained, for example, by reading K&B).
Questions under construction
String pool Q
post this if useful...
(1) Question checks the knowledge in immutable String class and knowledge in how Objects are maintained in the Object area, String pool and references....
String str1 = new String("charith");
String str2 = new String("charith");
String str3 = "charith";
String str4 = "charith";
System.out.print((str1==str2) + " ");
System.out.print(str3==str4);
Answers
1) false false
2) true true
3) true false
4) false true
5) compilation fails
charithf@gmail.com
- Thanks Charith, nice question! I've input this and posted it as today's question of the day (fire up Java.Inquisition and click "add test from web", then select the one for 27/October/2006). Matt 01:30, 27 October 2006 (BST)
Object References
(2) checks the knowledge of Sorted collection classes and Object behaviour
Set set = new TreeSet();
set.add("F");
set.add("B");
set.add("E");
set.add("A");
int count=0;
while(set.iterator().hasNext()){
System.out.print(set.iterator().next()+" ");
count++;
if(count==3)break;
}
1) F B E
2) A B E
3) A B E F
4) F E B
5) none of the above
The correct Result is going to be A A A because when the iterator is requested from the TreeSet it returns a new iterator object which you try to iterate. which means each time the loop runs it searches in a new iterator object. if we dont break it after three iterations it will go on forever charithf@gmail.com
- Thanks Charith, I've added this one as well (and I've tweaked the wording of the explanation just a little, I hope you don't mind). As an example, you can see the resultant XML from this question here: /XML example. Matt 00:37, 31 October 2006 (GMT)
Feedback/bugs in existing questions
...
Project members
(Please add yourself if you like).
- Matt Russell
External links
- Sun page on SCJP 5 — includes syllabus
- SCJP FAQ — at JavaRanch
- How to write a quality question — on JavaBlackBelt
- Online Java source highligher — outputs HTML
- JavaRanch SCJP forum

