• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Errors in Mr.Marcus Green's Mock 2

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First , thanx for Mr.Marcus Green's mock.
I took exam 2 today, socore 57/60 .
but, some doubts:
1> there are so many questions about AWT and IO,it is for 1.2 exam?
2>
Question 42)
Which of the following statements about threading are true
1) You can only obtain a mutually exclusive lock on methods in a class that extends Thread or implements runnable
2) You can obtain a mutually exclusive lock on any object
3) A thread can obtain a mutually exclusive lock on an object by calling a synchronized method of that object.
4) Thread scheduling algorithms are platform dependent
Answer 42)
Objective 7.3)
2) You can obtain a mutually exclusive lock on any object
3) A thread can obtain a mutually exclusive lock on an object by calling a synchronized method of that object.
4) Thread scheduling algorithms are platform dependent
Yes that says dependent and not independent.
BUT, about answer 2), i believe , should be "You can obtain a mutually exclusive lock on any object which have some synchronied block or method". right?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
4) Thread scheduling algorithms are platform dependent
Yes this is true, they are dependent on the platform, on one OS it might be based on pre-emptive, another it might be co-operative, on another it might be some other approach the OS designer came up with (the position of the planets?).
BUT, about answer 2), i believe , should be "You can obtain a mutually exclusive lock on any object which have some synchronied block or method". right?
2) You can obtain a mutually exclusive lock on any object

This option might be slightly better phrased to say "it is possible to obtain...". In the sense that under some circumstances it is possible. I think you are reading too much into the option, but I am keen to hear what other people think on this.
Marcus
[ December 08, 2002: Message edited by: Marcus Green ]
 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's not a must that the object has a synchronized block or method for a Thread to obtain a lock on it. Consider a thread calls a method of object X that has a synchronized block on object Y. Whether object Y has any synchronized methods or blocks, it doesn't matter, the thread WILL obtain object's Y lock. Right??
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On instantiation, every Object will have its own syncronization lock. This lock can be used by that instance, but could also be used by another Object's method (i.e. supplied as an argument to the method).
AFAIK, its poor coding style - but it can be done.
.02 cents
 
Todd Killingsworth
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of (supplied as an argument to the method), I should have said supplied as an argument to synchronized.
i.e.

I hate hitting send too soon. Need more coffee
Todd
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic