GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Marcus Mock exam 2 Threads 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 "Marcus Mock exam 2 Threads" Watch "Marcus Mock exam 2 Threads" New topic
Author

Marcus Mock exam 2 Threads

joy
Greenhorn

Joined: May 15, 2000
Posts: 16
This is no. 22 of Marcus Mock exam
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
My answers are only 1 and 3. but the given answer is 1,2,3.
A thread can stop executing if a thread is given a higher priority? I thought that if a thread is given a higher priority while another thread is running will only be moved to the ready state but it will not stop the currently running thread to stop executing.
Am I right?
regds,
joy
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

Thats my impression too, but before the exam.
From my previous discussions I have to believe that
this is not true. The reason is that the this is a
platform dependent issue. In most/some JVMs the thread
schedulers will stop the running thread if there is a
higher peiority thread. If you were thinking like me,
there is another qstn abt threads that has the same
principle. I go these two wrong when I attempted the test.
I don't remember the other one right now ....
Here is the previous discussion ...I was thinking of
revising this post ....thanks for re-posting.
Previous discussions
Regds.
- satya
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by joy:
This is no. 22 of Marcus Mock exam
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
My answers are only 1 and 3. but the given answer is 1,2,3.
A thread can stop executing if a thread is given a higher priority? I thought that if a thread is given a higher priority while another thread is running will only be moved to the ready state but it will not stop the currently running thread to stop executing.
Am I right?
regds,
joy

I got this exact question on the real exam and answered 1, 2, and 3. I got 100% on the thread section of the exam. Nuff said.
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
All the best Mock exams include a little explanation with the answers. Here is what that fine chap Marcus says as part of the answer to that question.
"Java threads are somewhat platform dependent and you should be carefull when making assumptions about Thread priorities.
On some platforms you may find that a Thread with higher priorities gets to "hog" the processor."
OK so not the best wording in the world, but you get the picture.
Marcus

SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Greg Whelan
Ranch Hand

Joined: May 18, 2000
Posts: 52
Re #3. Isn't the stop method deprecated in Java2? Does Sun have a policy somewhere relating to deprecated methods for SCJP?
I would have answered only 1 (and now that I've heard seen the writing on the board, 2 also).
Greg Whelan
Ranch Hand

Joined: May 18, 2000
Posts: 52
I see there's been some discussion of stop() appearing on SCJP exam... but I haven't seen a definitive answer as to whether it's considered an acceptible answer.
http://www.javaranch.com/ubb/Forum24/HTML/001414.html
Kent Farnsworth
Greenhorn

Joined: May 31, 2000
Posts: 7
I just took the SCJP exam and I had a question like this on the exam. I suggest you do not read any more into the question then there is. The fact that the method is deprecated is not the point, it can still be used!
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
the fact that STOP is a deprecated method should make a diffrence
since this the java 2 exam although it can be used and will compile with a warning is irrelevent as it is not part of the java 2 api which the test is supposed to be based on
Eric Barnhill
Rancher

Joined: Feb 25, 2000
Posts: 233

I got a question involving stop() on the SCJP last week.
Eric B.
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Eric,
I didn't get any qstn involving any deprecated method.
Eric, since you got a qstn with dep.d method, why don't you put a full stop for this ongoing discussion. Not to discuss any real exam qstn. Just to assure that should we select the answer with deprecated method if at all it is eligible answer for the qstn.
Thank you.
regds
maha anna
 
GeeCON Prague 2014
 
subject: Marcus Mock exam 2 Threads