aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Khalid mock exam question (pls help urgent) 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 "Khalid mock exam question (pls help urgent)" Watch "Khalid mock exam question (pls help urgent)" New topic
Author

Khalid mock exam question (pls help urgent)

Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
Under what circumstances will a thread stop?
Select all valid answers.
(a) The method waitForID() in the class MediaTracker is called.
(b) The run() method that the thread is executing ends.
(c) The call to the start() method of the Thread object returns.
(d) The suspend() method is called on the Thread object.
(e) The wait() method is called on the Thread object.
The answer given is: b
But I think the answers should be a,b,d,e should all be correct.
I guess the confusion here is with the word "stop" and "block". Can anyone comment on this?
Also what about MediaTracker...will it block a thread from running?
Please reply as I'm taking the exam tomorrow
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
The exact same question has been discussed in detail here
Good luck for your exams
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Following are my views. please correct me if i am wrong.
I think when the question says "stop", it means never having a chance to run again.
(a) The method waitForID() in the class MediaTracker is called.
The thread blocks and goes to "Wait" state. it does not stop.
(b) The run() method that the thread is executing ends.
The Thread stops
(c) The call to the start() method of the Thread object returns.
The thread does not stop in this case. very obvious.
(d) The suspend() method is called on the Thread object.
The thread goes to a "wait" state and might become "Ready" again when the resume() (deprecated) method is called.
(e) The wait() method is called on the Thread object.
The thread goes to a wait state. Might run again.
Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
Hi
Now it is time to clear all the doubts. i am going to take exam very soon.
what does the exact meaning of "stop" word in context of thread ?
Because in the link provided by "ajith" in this thread he is taking "stop" as temporally stop of thread and thread may be runnable after some time.
In case of khalid exam he is taking "stop" as permanent "stop" of thread. (because Answer given for the question is �b�)
please help me to clear my confusion.
vivek
Sandra Marti
Ranch Hand

Joined: Jun 08, 2000
Posts: 63
Junaid,
I am sure your concepts about Threads are clear. You are not sure about this answer only because you are not sure what Khalid really means by 'stop'. I doubt if 'Sun' will have any such questions where you have to wonder what the question really is. So don't panic. All the best in your exam tomorrow.
 
 
subject: Khalid mock exam question (pls help urgent)