This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes Thread question form MindQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Thread question form MindQ" Watch "Thread question form MindQ" New topic
Author

Thread question form MindQ

Chun Wang
Ranch Hand

Joined: Jan 24, 2001
Posts: 42
41. For what reasons might a thread stop execution?
a) A thread with higher priority began execution.
b) The thread's wait() method was invoked.
c) The thread invoked its yield() method.
d) The thread's pause() method was invoked.
e) The thread's sleep() method was invoked.
my answer is b,c,d,e. I don't know what the correct answer is but it tells me I was wrong. could anyone help tell me what is correct and explain? thanks a bunch.
chun
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The key here is that it says "MIGHT" stop a thread.
A. True — Some systems will stop threads of lower priority to start threads of higher priority, some don't but again, this might be true.
B. True — wait() will put the thread into waiting state, so it does stop it.
C. True — yield() will cause a thread to stop for higher priority threads. So it does cause it to stop.
D. False — There is no pause method.
E. True — sleep() will cause a thread to stop for a given amount of time.
Bill
deepak1
Greenhorn

Joined: Feb 02, 2001
Posts: 4

Hi
I am not satisfied with the second option .
"The thread's wait() method was invoked."
since wait() method is defined in the object class.So how can a thread's wait() method can be invoked. What i meant that the statement should be like that ..
"The wait() method is called."
thanks
deepak
Haining Mu
Ranch Hand

Joined: Jun 01, 2001
Posts: 51
I am not satisfied with the second option .
"The thread's wait() method was invoked."
since wait() method is defined in the object class.So how can a thread's wait() method can be invoked. What i meant that the statement should be like that ..
"The wait() method is called."

Thread class inherit wait() from Object, so I think it is now his method.
And I think answer e) is wrong since no sleep() method in Thread class which does not take a parameter.
Jyotsna Umesh
Ranch Hand

Joined: May 09, 2001
Posts: 94
Originally posted by Haining Mu:
Thread class inherit wait() from Object, so I think it is now his method.
And I think answer e) is wrong since no sleep() method in Thread class which does not take a parameter.

Hi everybody,
I agree with Bill, he has explained well and i see option e is right becoz for exam's purpose you will have to make certain assumptions. Right!
Jyotsna
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Thread question form MindQ
 
Similar Threads
doubt in thread
Thread execution
Is the answer right about this question?
MindQ question #41
Garbage collection