This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Valentin's mock exam.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Valentin Watch "Valentin New topic
Author

Valentin's mock exam..

sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
Can anyone please tell me where I can find Valentin's mock exam?
Thanks.


Sunita<br />SCJP 1.4
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
There you go:
Val's mock exam
Good luck


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

Joined: Oct 03, 2002
Posts: 257
Hai Valentin,
Thanks.. Will try it out...
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
How can I check the answers in the mock exam? I clicked submit and it gave me a score but I was not able to see the correct answers...
Thanks.
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
The questions were tough.. Will it be this tough in the real exam also?
Thanks
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
Hai Valentin,
The question below states that there are 2 correct answers... ButI think that only C is correct...
--------------------------------------------------
Question 16. What is the output of the following code when compiled and run? Select two correct answers.
public class Question16 {
public static void main(String[] args) {
int i = 2;
try {
if((i/=(int)Math.floor(Math.random())) > 1)
System.out.println("No arithmetic exception");
} catch (ArithmeticException ae){
System.err.println("Arithmetic exception caught");
}
}
}


A. Compilation error.
B. No arithmetic exception will never be printed.
C. The final value of i is 2.
D. The final value of i is 0.
E. The try-catch block is necessary for the code to compile.
-------------------------------------------------
Thanks
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by sun par:
The question below states that there are 2 correct answers... ButI think that only C is correct...
((i/=(int)Math.floor(Math.random())) > 1)

Math.random() - Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
So the result will always be less than 1.
Math.floor() - Returns the largest (closest to positive infinity) double value that is not greater than the argument and is equal to a mathematical integer
So it always truncate the result of Math.random() to zero.
Therefore the expression will always generate a divide-by-zero error. The correct answers are B and C.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
Thank you for making things clear..
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Originally posted by sun par:
The questions were tough.. Will it be this tough in the real exam also?
Thanks

The real exam won't be that hard. I intentionally made this mock exam hard to provide a little more challenge for people who want to get this a little further and seek for a very good score.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Valentin's mock exam..
 
Similar Threads
59.3% on Valentin's exam !!!
Passes SCJP with 95%
Is this encouraging enough?
cleared SCJP with 95%
Unicode charector as String literal; finalize() method