• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do visit the mock exam and give me some feedback.
Enjoy it!
Guoqiao Sun
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very good design and user friendly web site.
Good luck in your business.
Jamal Hasanov
www.j-think.com
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks Great but harder than the real exam I guess.
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain me how it is 12 bytes?
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep on going SUn... you've been doing a good job
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

reply
    Bookmark Topic Watch Topic
  • New Topic