This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP Mock Tests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP Mock Tests" Watch "SCJP Mock Tests" New topic
Author

SCJP Mock Tests

Chris R Barrett
Ranch Hand

Joined: Dec 05, 2013
Posts: 49
    
    1

Hi all,

I apologize if this the wrong forum location.
I was running some mock SCJP exams on http://scjptest.com today and was presented with the following question:

Given the code. What is the result?



The possible answers were:
A) Compilation fails.
B) An exception is thrown at runtime.
C) "BeginRunEnd" is printed.
D) "BeginEndRun" is printed.
E) "BeginEnd" is printed.

As I understand it, a and main are going to be separate threads, therefore the output could be "BeginRunEnd" (option C), but could also be "RunBeginEnd" depending on the OS thread process sequence.
Just to be sure, I tried the code on my Mac in Eclipse and about 1 out of 5 times the result was "RunBeginEnd".

I'm wondering on the real exam how many questions are similar to this format - where the answer option is only part of the real answer, or is a 'choose the best possible answer' format?

Cheers!
Chris
Heena Agarwal
Ranch Hand

Joined: Dec 25, 2013
Posts: 261
    
    4
Chris R Barrett wrote:
Given the code. What is the result?



The possible answers were:
A) Compilation fails.
B) An exception is thrown at runtime.
C) "BeginRunEnd" is printed.
D) "BeginEndRun" is printed.
E) "BeginEnd" is printed.

As I understand it, a and main are going to be separate threads, therefore the output could be "BeginRunEnd" (option C), but could also be "RunBeginEnd" depending on the OS thread process sequence.
Just to be sure, I tried the code on my Mac in Eclipse and about 1 out of 5 times the result was "RunBeginEnd".


You're right. The question should have said something along the lines of 'which of the following is a possible output'.
But I would have chosen C cause every other option is not possible.

Chris R Barrett
Ranch Hand

Joined: Dec 05, 2013
Posts: 49
    
    1

Hi Heena,

Thank you for the feedback.

Cheers!
Chris
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SCJP Mock Tests
 
Similar Threads
Threads Question
Help in a question about Threads
Threads
Concurrency question
Thread question from www.scjptest.com