jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes I have rewritten my mock exam and put it at http://www.jiris.com/ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "I have rewritten my mock exam and put it at http://www.jiris.com/" Watch "I have rewritten my mock exam and put it at http://www.jiris.com/" New topic
Author

I have rewritten my mock exam and put it at http://www.jiris.com/

Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Do visit the mock exam and give me some feedback.
Enjoy it!
Guoqiao Sun


Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="http://www.jiris.com/" target="_blank" rel="nofollow">www.jiris.com</a>, Java resource, mock exam, forum
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Very good design and user friendly web site.
Good luck in your business.
Jamal Hasanov
www.j-think.com
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you for your encouragement, Jamal. Please visit again and give me more suggestion!
Sincerely yours,
Originally posted by Jamal Hasanov:
Very good design and user friendly web site.
Good luck in your business.
Jamal Hasanov
www.j-think.com
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
Looks Great but harder than the real exam I guess.


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
Took one of the mock exams today,seems to be a little tough.
To compare with the real exam : is this supposed to have been created tough or on-par ?.Pl.reply.
Swati Gupta
Ranch Hand

Joined: May 28, 2002
Posts: 106
Just took the 1st mock exam and scored 67% only.
Some marks I lost because I didn't pay attention and was in hurry to complete the test.
Enjoyed taking the exam. But this is little tough. Now I am looking at the explanation which seems concise and good.
Good Work.
Will take rest two exams in few days.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, swati, geetha and Thiru:
As I have mention in the web site, the mock exam is tougher than real exam. So NEVER feel frustrated if not getting a very nice score!
It is just for practice purpose! And I purposely make it tougher than real exam.
Sincerely yours and best luck to your SCJP2 tour!
Brian Lugo
Ranch Hand

Joined: Nov 10, 2000
Posts: 165
Hi Sun!
I believe there is a mistake in Q49 in test2.

The correct answer is 12 bytes due to the seek before //1.
Feel free to correct me if I am wrong,
Brian
PS - Never mind the question asks for how many bytes are written to the file and not the length of the file!!!
[ June 04, 2002: Message edited by: Brian Lugo ]
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Yes, Brian:
The original answer is B is correct.
regards,
Guoqiao
Originally posted by Brian Lugo:
Hi Sun!
I believe there is a mistake in Q49 in test2.

The correct answer is 12 bytes due to the seek before //1.
Feel free to correct me if I am wrong,
Brian
PS - Never mind the question asks for how many bytes are written to the file and not the length of the file!!!
[ June 04, 2002: Message edited by: Brian Lugo ]
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
Can you explain me how it is 12 bytes?
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Thiru:
The process will be:
write 2 bytes (1 char)
write 4 bytes (1 int)
write 4 bytes (1 int)
after that,
seek 4 bytes
write 8 bytes (1 long)
totally 2 + 4 + 4 + 8 bytes ever write.
but the file length is still 12 byte.
Guoqiao
Originally posted by Thiru Thangavelu:
Can you explain me how it is 12 bytes?
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
Just curious to know how it has written the characters but the output is junk characters.. Can you explain how I can see the output(may be ascii charaters)?
import java.io.*;
public class Test {
public static void main(String[] args)
{
try
{
File f = new File("test.txt");
RandomAccessFile r = new RandomAccessFile(f, "rw");
r.writeChar((char)65);
r.writeInt(30000);
r.writeInt(3);
r.seek(4);
r.writeLong(5); //1
r.close();
RandomAccessFile r1 = new RandomAccessFile(f, "r");
for(int i=0;i<r1.length();i++)
System.out.print((char)r1.read());
r1.close();
}
catch(Exception e) {
}
}
}
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Thiru:
The output might not be readable. Since after seek(4), the first four bytes contain 1 char and the first half of the int number, plus the 8 bytes inserted afterwards, the result might not be readable characters.
regards,
guoqiao



Originally posted by Thiru Thangavelu:
Just curious to know how it has written the characters but the output is junk characters.. Can you explain how I can see the output(may be ascii charaters)?
import java.io.*;
public class Test {
public static void main(String[] args)
{
try
{
File f = new File("test.txt");
RandomAccessFile r = new RandomAccessFile(f, "rw");
r.writeChar((char)65);
r.writeInt(30000);
r.writeInt(3);
r.seek(4);
r.writeLong(5); //1
r.close();
RandomAccessFile r1 = new RandomAccessFile(f, "r");
for(int i=0;i<r1.length();i++)
System.out.print((char)r1.read());
r1.close();
}
catch(Exception e) {
}
}
}
Swati Gupta
Ranch Hand

Joined: May 28, 2002
Posts: 106
Following is the code from exam no 2:-
What is the output of trying to compile and run the following code?
(Select one correct answer)
When I try to compile it it gives error at 1
saying "qualified new of static class" I don't understand what does that mean
The answer given is that error at 2.
I thought that all the lines 1,2,3 are right as it is static inner class and static method.pl. explain.
Thanks.

Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, swati:
The mock exam question you mentioned really got some problem. When I created this mock exam, I used JDK 1.2, it gave error at line //2. But now I am using JDK 1.3.1. It gives the following:
An exception has occurred in the compiler (1.3.0). Please file a bug at the Java
Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your
program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.v8.comp.TransInner.access( TransInner.java:722 )
at com.sun.tools.javac.v8.comp.TransInner._case( TransInner.java:1558 )
at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:963)
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35)
at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1552)
at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:963)
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.comp.TransInner._case(TransInner.java:1485)
at com.sun.tools.javac.v8.tree.Tree$Apply.visit( Tree.java:785 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.tree.TreeTranslator._case( TreeTranslator.java:179 )
at com.sun.tools.javac.v8.tree.Tree$Exec.visit( Tree.java:699 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:47 )
at com.sun.tools.javac.v8.tree.TreeTranslator._case( TreeTranslator.java:111 )
at com.sun.tools.javac.v8.tree.Tree$Block.visit( Tree.java:492 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.tree.TreeTranslator._case( TreeTranslator.java:100 )
at com.sun.tools.javac.v8.comp.TransInner._case( TransInner.java:1418 )
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit( Tree.java:441 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.comp.TransInner._case( TransInner.java:1355 )
at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit( Tree.java:402 )
at com.sun.tools.javac.v8.tree.TreeTranslator.translate( TreeTranslator.java:35 )
at com.sun.tools.javac.v8.comp.TransInner.translate( TransInner.java:1317 )
at com.sun.tools.javac.v8.comp.TransInner.translateTopLevelClass( TransInner.java:1583 )
at com.sun.tools.javac.v8.JavaCompiler.compile( JavaCompiler.java:397 )
at com.sun.tools.javac.v8.Main.compile( Main.java:247 )
at com.sun.tools.javac.Main.main(Main.java:16)
:-(
I will further probe into it and then decide how to modify the question. Anybody who has better idea?
Thanks anyway for your nice feedback!
Guoqiao
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
It gives me the following error. I am using jdk 1.2.2.012(ROUGHLY 1.2.2). Any other error/feedback on this questions? So, what is the correct answer for this question?
C:\java\Test.java:4: No variable Nested defined in class Test.
new Test038().Nested.method("second"); //2
^
1 error
Tool completed with exit code 1
Swati Gupta
Ranch Hand

Joined: May 28, 2002
Posts: 106
If I comment //1 and //2 it works .
that means the //3 is the only right answer?
I am using 1.4
[ June 10, 2002: Message edited by: swati gupta ]
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
For me,it is compiling if i comment line 2(//2). But I am getting a runtime exception like this
java.lang.VerifyError: (class: Test0038, method: main signature: ([Ljava/lang/String V) Expecting to find unitialized object on stack
Exception in thread "main"
Anyone can explain what is happening here?(may be Sheriffs or Bartenders)???
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
Hi Guoqiao Sun,
I got 74%,74%, 57% on your 1st, 2nd, 3rd exams respetively(You can see my name on the list of people who has taken the exam). Am i ready for the exam? Still I feel my score is less. What do u suggest?
[ June 10, 2002: Message edited by: Thiru Thangavelu ]
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Keep on going SUn... you've been doing a good job


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Thiru:
Thanks for taking my mock exam and give me feedback!
You have achieved quite nice score in the mock exam, as you can see from the top 10 list. You are almost top 3. :-)
SO... I am almost 100% you will pass the real exam! Go ahead!
And don't forget to tell us your good news when passing the exam!
Guoqiao
Originally posted by Thiru Thangavelu:
Hi Guoqiao Sun,
I got 74%,74%, 57% on your 1st, 2nd, 3rd exams respetively(You can see my name on the list of people who has taken the exam). Am i ready for the exam? Still I feel my score is less. What do u suggest?
[ June 10, 2002: Message edited by: Thiru Thangavelu ]

[ June 11, 2002: Message edited by: Guoqiao Sun ]
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Valentin;
Long time no see, how is everything going?
Thanks for your encourgement, hope to get more suggestions from you. I still remember you gave me quite a lot of suggestions when I created my mock exam!
Have a nice day to you!
Guoqiao
Originally posted by Valentin Crettaz:
Keep on going SUn... you've been doing a good job
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I have rewritten my mock exam and put it at http://www.jiris.com/