Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes dear all, i created a set of mock exam, please try it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "dear all, i created a set of mock exam, please try it." Watch "dear all, i created a set of mock exam, please try it." New topic
Author

dear all, i created a set of mock exam, please try it.

Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Please try it and give me some feedback, hope it helps.
The URL is:
<code> http://www.geocities.com/sun_guoqiao/
</code>

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform


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
ashok khetan
Ranch Hand

Joined: Jul 29, 2001
Posts: 153
hey! u are doing a fabulous job!it's pretty good.
keep going on man!!!

ashok.
leena rane
Ranch Hand

Joined: Aug 13, 2001
Posts: 280
Hi Guoqiao,
Thanx a lot for the efforts,
Your efforts will be appreciated by all aspirants SCJPs like me.
thanx again
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
gr888888 work Guoqiao !!!
liked ur presentation style , n specially those handy explanations with answers
it 'll indeed turn out to be very helpful for us SCJP-aspirants
i 'll surely give u feedback to make it better , if i find any sort of error etc
Once again 'll like to thank u for ur effort put into making this .. have dis cool drink wid me !
Keep up da good work ma'n , u doin gr8 job , waiting for more
------------------
Gagan (/^_^\)


Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Good job Guoqiao Sun!!
Thank you!!
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Great site Guoqiao! The way you have explained the answers are very helpful.
Thanks,
Vanitha.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you all for your reply and encourgement, I 'd like to know the difficulty level of this mock exam as compared to other mock exam. If it is too difficult, i will make it easier in my later mock exam.
I have no means to know it myself since when i created it, i use compiler all the times in order to get the right answer and show it to you.

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
I have reviewed once again of the mock exam 1 and removed several wording errors there. Please tell me if you find any errors! Thank you!
------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13
<PRE>
Hi Guoqiao Sun
Your idea is excellent.
Question number 17 was quite interesting to me.

public class Test017
{
public static void main(String args[])
{
System.out.println(Math.abs(Byte.MIN_VALUE) > 0);
System.out.println(Math.abs(Long.MIN_VALUE) > 0);
System.out.println(Math.abs(Short.MIN_VALUE) > 0);
System.out.println(Math.abs(Float.MIN_VALUE) > 0);
}
}

I was expecting "true, true, true, true"
Refered Sun's web site for abs() method. http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Math.html#abs(long)
What I understood is,
When argument to abs() is either Integer.MIN_VALUE or Long.MIN_VALUE, the result remains same, ie.,
negative
Integer.MIN_VALUE = -2147483648 if we negate this value, which is 2147483648 and
it CANNOT be represented in int type.
The max value that can go into int data type is 2147483647
Same theory applies to abs(Long.MIN_VALUE)

Cheers
Usha
</PRE>
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you, Usha, I will put your words into the explanation of the questions 17.

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13
<PRE>
Hi Guoqiao,

I think the answer for question 42 is D. I got the output "0"
Here is the question. Please correct me if I am wrong.
public class Test042 extends Super
{
private int i = 1; //1

public static void main(String args[])
{
Super s = new Test042(); //2
System.out.println(s.i); //3
}
}
class Super {
protected int i = 0;
}

</PRE>
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13
<PRE>
Small typo error in question # 31.
You got two choices with the same name.
D: The code does not compile because of line //1
D: The code does not compile because of line //2
The last choice should be "E". And the answer for this question
is "The code does not compile because of line //2 "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
What is the output of trying to compile and run the following code?
(Select one correct answer)
-----------------------------------------------------------------------
public class Test031
{
public static void main(String args[])
{
StringBuffer sb = new StringBuffer("Hello");;
String st = new String("World");

System.out.println(sb.append(st)); //1
System.out.println(st.concat(sb)); //2
}
}
-----------------------------------------------------------------------
A: The code compiles and runs with output:
HelloWorld
WorldHello
B: The code compiles and runs with output:
WorldHello
HelloWorld
C: The code compiles and runs with output:
Hello
World
D: The code does not compile because of line //1
D: The code does not compile because of line //2
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you, Usha, I will check it out and soon correct it.
Hi, Usha, as to question 42, you are right, I have correct it and if you like, go to have a check!
------------------
Guoqiao Sun
Sun Certified Programmer for Java� 2 Platform
[This message has been edited by Guoqiao Sun (edited September 03, 2001).]
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13

Hi Guoqiao,
I am back again working on your mock exam. I like the way you presented the answers, placing them next to questions, reduces lot of overhead, looking back and forth etc.
One suggestion regarding Q22.
I don't think you need
"What is the output of trying to compile and run the following code? " at the beginning of question number 22.
Becz there is no code in the question.
I think you copied the tags from the previous questions and made corections to it.

usha

[This message has been edited by Thomas Paul (edited September 04, 2001).]
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Usha, I will correct the error as you mentioned in question 22.
You are right, I created this mock exam with the intention of easy using. Since when I prepared for the exam and did the mock exam, I found it very tedious to scroll up and down to check the answer.
Good luck!

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13
Typo error in Q#7 just like question 31.

D: The code does not compiles.
D: The code compiles but cannot run.
Okay, its time to go for lunch, good work Guoqiao.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thanks again, Usha, error has been cleared as to Q#7.

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Rashmi Trivedi
Ranch Hand

Joined: Aug 13, 2001
Posts: 60
Dear Guoqiao
You are a good man. I am sure every body in this forum will appreicate your effort. I wish i could do the same thing once i get my scjp.
Good luck mate and keep it up.
Rashmi
Originally posted by Guoqiao Sun:
Please try it and give me some feedback, hope it helps.
The URL is:
<code> http://www.geocities.com/sun_guoqiao/
</code>


Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you, Rashmi. You can consider to collect valuable material and resource during the time of your preparation if you want to share your something about SCJP with others later time.
Good luck to your SCJP tour!
------------------
Guoqiao Sun
Sun Certified Programmer for Java2 Platform
Visit http://www.geocities.com/sun_guoqiao/ for mock exam from me
[This message has been edited by Guoqiao Sun (edited September 03, 2001).]
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Guoqiao,
Really excellent job done, my ddear friend! Have a can of beer with me....

------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer For Java 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Ashik, thanks for the compliment. Very glad to have a can of beer with you...

Best luck!

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
[This message has been edited by Guoqiao Sun (edited September 04, 2001).]
Adam S-R
Greenhorn

Joined: Aug 15, 2001
Posts: 18
Guoqiao
Great site - I like your explanations to the questions. The only thing I would say is would you consider making the text a bit bigger? I can't read it comfortably on my 15" monitor without straining my eyes. Perhaps you might consider using a serif font such as arial or verdana, or making the text bigger?
Adam
Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
why i can' open the url?


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Adam, I will make the text bigger soon. Thanks for the feedback. Good luck!
Originally posted by Adam S-R:
Guoqiao
such as arial or verdana, or making the text bigger?
Adam


------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Xiuyuan, i don't know the reason, it should work with the URL. Please try again!
Good luck!
Originally posted by Niu Xiuyuan:
why i can' open the url?


------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
swati bannore
Ranch Hand

Joined: Oct 18, 2000
Posts: 201
Hi,
Thanx Sun....very good questions..I enjoyed it!
There is one small mis-woring error in q45


What is the output of trying to compile and run the following code? (Select one correct answer)
-----------------------------------------------------------------
public class Test045 extends Super { }
class Super
{
public static void main(String args[])
{
System.out.println("super main!");
}
}
-----------------------------------------------------------------
A: The code compiles but throws NoSuchMethodError
at runtime.
B: The code does not compile.
C: The code compiles and runs without any output.
D: The code compiles and runs without output:
super main!

Of, crse, option is D...but it shd read," The code complies and runs with Output:super main!

Swati Kale
SCJP
SCWCD
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you, swati, the error has been cleared as you instructed.
Good luck!
Originally posted by swati bannore:
Hi,


[This message has been edited by Guoqiao Sun (edited September 04, 2001).]
Adrian Uribe
Greenhorn

Joined: Sep 05, 2001
Posts: 1
Question 1 on this mock exam seems to address a bug in the jdk. The explanation shows what is output from running the code but it does not seem logical that this is what should happen. Comments?
Good job on the rest.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I'm really impressed Guoqiao. Great job. I have just gone over it briefly but I know that these mocks will help me on my way to SCJP, which is by the waay 28 sep.
Thanks again. I will spread your link to my friends at work.
// Mathias
Dallas Hockley
Greenhorn

Joined: Aug 30, 2001
Posts: 3
I agree that that seems to be an inconsistency or a bug on the JDK. System.out.println(t1.toString()) should be the same as System.out.println(t1) as I understand the automatic typecast/method call in that situation. I've verified it on 1.3.1 on Windows, and on 1.4 Beta 2 on Windows. Very odd.
Update: And on 1.3.0_02 on Linux. and kaffe 1.0.6 (Java 1.1) on Linux. So it's consistent and/or historic whatever the case.
Dallas

[This message has been edited by Dallas Hockley (edited September 05, 2001).]
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thanks to Adrian, Mathias and Dallas for your feedback.
So do you think it is proper to include the question in the mock exam? Or should I remove it?
Best regards,
I am busy with creating my mock exam 2.

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Adrian and Dallas, i have put your words about question 1 on my mock exam answer. Thank you!

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Hi Guoqiao,
Your mock exam helps a lot.
I think there is an error in this question,

But I think this code will give compiler error, since line 1
is not using outer class instance to refer the inner class. You can change the answer choice, or you can change the make it as a
static inner class.
Thanks for your wonderful job,
Vanitha.
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Also one more thing, for the question 01-15,
At present the explanation is "Please see the JLS for reference"
Since the question is about the constructors of the class FileOutputStream you can say it as Please refer Java API.
Just a little suggestion,
Vanitha.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Thank you, Vanitha, I will change the words there.
To be honest, i am not quite clear what is the difference between JLS and Java API. Please tell if you know.
As to question 01-14, since the outer class just access the static variable in the inner class, thus no instance of outer class is needed. You can use Java compiler to confirm it.
Regards,

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
Try my mock exam¹ at my homepage.
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Hi,
This is what I got when I compiled the question 14.

Test014.java:12: Can't make a static reference to inner class Test014. Inner.
System.out.println(Test014.Inner.j); //1
1 error

JLS is Java Language Specification.
API is Application Programmer Interface
Thanks,
Vanitha.
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Vanitha, thanks for telling JLS and API.
As to question 14, i can confirm with you that it compiles and runs with the output i mentioned in the question in my machine. I don't know why you got error. What version of JDK you are using? I am using 1.3.0
Regards,
------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹² at my homepage.
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356

I am using JDK 1.2
Vanitha.
Jon Ellison
Greenhorn

Joined: Jan 10, 2001
Posts: 19
Guogiao,
I got the same error that Vanitha recieved... I am using JDK 1.3
It didn't compile and run until I made the inner class static.
So I guess that "A" may be the correct answer here?
Regards,
Jon Ellison


Jon Ellison<br />Java Developer at Large<br /> <br />-----BEGIN GEEK CODE BLOCK-----<br />Version: 3.1<br />GIT d- s: a+ C++ UA P+ L- E-- W+++ N++ o-- K- w+ O- M-- V-- PS--- PE+++ Y<br />PGP t++ 5 X+ R-- tv++ b DI+ D-- G e++ h---- r+++ y++++<br />------END GEEK CODE BLOCK------
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
Hi, Jon and Vanitha. Now I finally found the error in my question. The reason is that I use Forte 2.0 for my compiling and testing of the programme. Just now I tested it just using JDK and found the error.
Sorry for the confusion caused. I will correct the error soon in my question.
Thanks and best wishes,

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹² at my homepage.
 
 
subject: dear all, i created a set of mock exam, please try it.