• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

macrus mock exam

 
shabbir zakir
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What can cause a thread to stop executing?
1) The program exits via a call to System.exit(0);
2) Another thread is given a higher priority
3) A call to the thread's stop method.
4) A call to the halt method of the Thread class
the correct answer given is 1,2,4
I understand 1,2 can come.But how option 3.the stop()method have deprecated.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you rephrase your qstn., i think you have a typo abt
ans 3 or 4 ?
regds.
- satya
 
Randall Twede
Ranch Hand
Posts: 4444
3
Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deprecated methods still work. It is just recommeneded not to use them.
 
Pratap Reddy
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(2) Another thread is given a higher priority. I don't think
by assigning high priority will let other threads to stop.
Correct answer in my opinion : 1 & 3. And regarding (4) I am not clear.
[This message has been edited by Pratap Reddy (edited January 08, 2001).]
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pratap,
If the application is running a system that uses 'time-slicing' a higher priority thread may pre-empt a lower priority thread; causing it to stop.
There is no method Thread.halt()
Hope that helps.
------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the question says what CAN cause a thread, not what WILL cause a thread. An important difference.
Marcus
 
Vladimir Kositsky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*yield CPU to other thread postpone execution of thread ( IMHO ).
*halt method - it could be interrupt()

[This message has been edited by Vladimir Kositsky (edited January 09, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic