GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread Problem from K&B practice exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread Problem from K&B practice exam" Watch "Thread Problem from K&B practice exam" New topic
Author

Thread Problem from K&B practice exam

Aashu Mahajan
Ranch Hand

Joined: May 27, 2011
Posts: 113

Source : OCP java SE programmer Practice Exam.(Q.31)

Which are true? (Choose all that apply.)
A. Compilation fails.
B. After throwing error(s), t3 will most likely complete before t4.
C. After throwing error(s), t4 will most likely complete before t3.
D. The code will throw one error and then no more output will be produced.
E. The code will throw two errors and then no more output will be produced.
F. After throwing error(s) it’s difficult to determine whether t3 or t4 will complete first.

Correct Answere : C
I could not understand why option 'E' is not correct because the code will throw two Errors. one error will thrown by "t1" and another error will thrown by "t2".
Please let me know where i am wrong??
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

why posting the same question in two different places..
The same question can be found Here also


SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Please have patience for someone to answer this.
Aashu Mahajan
Ranch Hand

Joined: May 27, 2011
Posts: 113

Sorry Guys

Actually my first post was written by mistake and while writing my doubts i didn't knew which forum i am using but when i return to forum then i came to know i posted in a wrong forum then i try to remove post but i did't find any option for deleting post.
Then i did repost my question on the correct forum.
Asad Zubair
Ranch Hand

Joined: May 08, 2011
Posts: 44

Option E is not correct because although there will be 2 errors thrown, it is highly likely (although not guaranteed) that more output will be produced. This is because there is a new thread being started (t3 and t4) just before the error is thrown so they will continue to run and print separately regardless of the errors being thrown by t1 and t2.


OCPJP6
Aashu Mahajan
Ranch Hand

Joined: May 27, 2011
Posts: 113

Thanks Asad Zubair for your response.

The Option 'E' does mean that after occurring two errors no more output will be produced. But actually after occurring two errors the output still appear on the screen. correct me if i am wrong.


Chandella Montero
Ranch Hand

Joined: Feb 18, 2011
Posts: 89
Why not C and F?

F. After throwing error(s) it's difficult to determine whether t3 or t4 will complete first.


t3 will most likely finish before t4, but not definitely, therefore it is difficult to determine that.

Determine = know for sure. Right?


OCA, OCP Java 6
 
GeeCON Prague 2014
 
subject: Thread Problem from K&B practice exam