hi mohamed,
here are my thoughts about the questions:
first question:
A) is clearly "no". example:
assume x and y are zero. one
thread (say "t1") executes setXY(5). after it has executed setX(5), it releases the object's lock. at this moment, another thread "t2" executes check(), returning <false>.
B) is a somewhat confusing question, because it does not say anything about the thread "t2" in the above example. basically, calling setXY() with multiple threads will not perpetually make i != j. but calling it with multiple threads while simultaneously calling check() with another thread might still return <false> (as in A). so i would answer "yes".
C) assuming "seperately" means "not through setXY, but directly", then the answer is "no", because they are private methods and can only be called through setXY.
D) "no" based on my above answer to "A"
Second question:
A) i assume the code will not run with 1.3 --> execution of main() method is skipped --> i.e. execution of ALL statements is skipped --> assertion statements are skipped -->
then the answer is clearly "yes" if my assumption is correct, this is an example of an imo ill-defined question, where you have to change the meaning of the question by yourself to answer it 'correctly' (in this case, you have to add "...but the other statements are not skipped").
I would say B is "yes", because "appropriate command line switch" may include "no command line switch"
as you may have noticed, some of these answers are highly subjective
regards
tiloif
[ March 16, 2006: Message edited by: Tilo Hemp ]