• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Thread question form MindQ

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic