aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Sun Practice Exam has incorrect answer? 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 "Sun Practice Exam has incorrect answer?" Watch "Sun Practice Exam has incorrect answer?" New topic
Author

Sun Practice Exam has incorrect answer?

Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
Sun appears to have the wrong answer for the following question from the first of its $75 practice exams:

For a single synchronized instance method with no wait() call involved, which two statements are true? (Choose two.)

A
The object lock is applied to the object containing the method.
B
Only synchronized methods can be called from within this method.
C
All methods accessed from within this method are inherently thread safe.
D
Only one thread of execution will be permitted to execute the method at one time.
E
Concurrent threads will be unable to execute other non synchronized instance methods in the same object while the synchronized method is being executed.


The given answer was A and D. However anyone who reads closely will notice that D is clearly false as written; more than one thread may execute the method on different instances of the class at the same time. Furthermore C as written is extremely vague (is it talking about this object only or other objects, what does it mean by "thread safe?) but seems to be true; from within a synchronized method if a non-synchronized method is called the thread will still hold the lock.

So based on the answer I know what they meant but clearly the answer is either wrong or it was a very poorly written question. Does anyone know if the actual exam has such poor questions? Are the practice exams representative of the actual one?
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
C is clearly false. Even though the method you are in is syncronized, other methods that you call that are not can be called by other threads. Doesn't matter if it is this object or other objects.

D is clearly true. I don't know how you can say a syncronized method can used by more than one thread at a time. If that was the case what would be the point of syncronization?

I don't see a problem with the question.
Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
> D is clearly true. I don't know how you can say a syncronized method can
> used by more than one thread at a time. If that was the case what would
> be the point of syncronization?

For instance methods, synchronization is based on an object, not a class. If there are two objects then there can be 2 threads in the method.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Did you read the question? 'For a single synchronized instance method'

If there were two Objects that would be two synchronized instance methods.
Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
An "instance method" simply means its not static. A "single" instance method means one method. Now even if there is only one method, there can stil be two objects.

Did YOU read the question? Please don't talk down to me any more. The rules say "be nice".
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Hi Paul,

I really think Steve is trying to help. As with any post it is easy to mis-interpret someone's tone. It happens all the time. He is just trying to explain why he feels that the question and answer is correct. Which I agree with him on his assessment.

When I read into his replies, I don't feel that he is trying to be condenscending towards you.

Your points are also accurate, in that if there were two objects, and two different callers on different objects calling that method, each object will be locked by the different callers and both execute. I think the question is at a higher level than direct implementations. So as a rule D is true. At this point it isn't about how many instances there are. And if you look at the sentence for D "Only one thread of exection will be permitted to execute the method at one time" Then the "the method" needs to be defined because if there are two instances then there are two methods, one in one instance and one in the other, so if that is the case then D is true again.

I hope this helps clarify whtat Steve was trying to say.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Steven]: If there were two Objects that would be two synchronized instance methods.

I certainly wouldn't describe it that way. I'd say two threads are calling the same single method using two different instances. I agree with Paul that D is untrue.

As for C, I agree with Steven that it's definitely false, for the reasons he gave.

[Paul]: Does anyone know if the actual exam has such poor questions? Are the practice exams representative of the actual one?

Well, we hope not. The real exam is much more rigorously reviewed than the practice exams. It's possible that errors and ambiguities got in anyway. I haven't seen the practice exams, but based on this one question I'd say you can expect the real exam to be better.
[ March 03, 2005: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
Thanks everyone, I shouldn't really worry about it I was just annoyed because I paid 75 bucks to get that exam and had to deal with one of the worst online shopping applications I have ever seen (which is a bit ironic i think ...) so I was a little mad at Sun. But ambiguity is inherent to any language (certainly English), I'll deal
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Originally posted by Paul Caplan:
Please don't talk down to me any more. The rules say "be nice".


I'm sorry for my tone, I didn't mean to be talking down and I will try to be careful about that in the future.

As for one vs two instance methods, I think that my answer there was badly worded. As the answer D is refering to 'the method' it seems to me that it is referring to a single instance object, and the method of that object.
Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
No problem Steve my excuse is I'm just stressed out from studying
Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
I believe that D is true. I think if you look at a question such as this with multiple answers, you also have to consider the choice answers. Some answers to this question pertains to only one instance, so the rest must also do the same. So that means that the question also pertains to only one instance as well.
[ March 03, 2005: Message edited by: Alton Hernandez ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Alton]: Some answers to this question pertains to only one instance, so the rest must also do the same.

I don't agree at all. When two answers have different wording, the differences in wording are important. That's what makes it possible to choose one answer instead of another. You can't assume that something stated in answer (E) should be part of your assumptions for answer (D). Down that road lies madness.

[Steven]: As the answer D is refering to 'the method' it seems to me that it is referring to a single instance object, and the method of that object.

Well, here's a class I wrote:

I would say that this class has one method. It is a single synchronized instance method. I can make other statements about "the method", such as "the method bar() doesn't really do anything." I'm quite happy thinking of this as a single method. If I then create five different Foo instances and call bar() once with each instance, I would not feel compelled to go back and revise my previous statement to say that class Foo now has five methods. It doesn't. It has eactly one method, no matter how many times that method gets called. Now, if you've heard me talk about "the instance method bar()", should you assume that I would never ever call this method using two different instances, or from two different threads? I don't think so. Referring to a method using "the" does not imply anything at all about the number of instances that might exist.
[ March 03, 2005: Message edited by: Jim Yingst ]
Paul Caplan
Greenhorn

Joined: Mar 03, 2005
Posts: 6
Glad someone else agrees with me The second sun practice exam has a similar question but specifically states "given one instance", which is much more nicer of them.
Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
Originally posted by Jim Yingst:
[Alton]: Some answers to this question pertains to only one instance, so the rest must also do the same.

I don't agree at all. When two answers have different wording, the differences in wording are important. That's what makes it possible to choose one answer instead of another. You can't assume that something stated in answer (E) should be part of your assumptions for answer (D). Down that road lies madness.
[ March 03, 2005: Message edited by: Jim Yingst ]


Granted that the question is ambigous and should not be asked in an exam. But face with this situation, where an examinee has no other choice but to answer, he has to understand the question on the context of the answers i.e. the consequent(answer) must be identical to the antecedent(question).

(A) and (E) are specific about a reference to a single instance, because of the phrases the object and same object. Although the rest are not talking about a single object, they are also not specific about more than one as well. So I will only assume the most specific and that the author is not changing context.

So for example, if I ask a question like this:


Which of the following I don't like:

1) Italian Food
2) Mexican
3) Japanese Food
4) Chinese


You would assume that question is about food, and that in options (2) and (4) I was not talking about Mexican and Chinese people?

[ March 03, 2005: Message edited by: Alton Hernandez ]
[ March 03, 2005: Message edited by: Alton Hernandez ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Well, with your food question, the difference is that there's really no good way to answer "do you like Chinese?" without some more context. Chinese food? Chinese people? Chinese language? I need that info in order to answer, and the question did not provide the info in any clear manner, and I am forced to guess. So in that case, I'll go ahead and take the context from the other options, while mentally cursing the question author for being unable to form a better question. I would have little confidence in this answer, because at this point I don't trust the question author to be competent. (No offense to you of course; this is hypothetical.) I'm just making my best guess.

In contrast, for the practice exam question, option D is clear enough already. It has a definite answer (false) based on the information provided. I don't need to import context from other answers - good, because that's a very questionable thing to have to do. Now, it turns out that in this case, the author did not intend the question in the way I interpreted it. (Based on the given answer, A and D.) So OK, now I would say that the author is simply wrong, and evidently this practice exam did not go through rigorous screening from Sun. The difference is that for the Chinese question, the incompetence of the author was evident immediately (since it was obvious more info was needed) while for the practice exam question, the author's incompetence was better hidden.

OK, "incompetence" is a little harsh for both authors; call it carelessness. Either way, the question was broken. I prefer to assume a question means exactly what it says, unless and until I see evidence that the question can't be interpreted that way. Now if I detect that a question is broken, I may be able to make a good guess as to what the author really meant. In this case, an obviously broken question (like "do you like Chinese?") is better than a subtly broken question (like option D). Still, if I don't see any obvious signs a question is broken, I prefer to assume the author knows what they're doing, rather than worry over all the possible ways the author might have subtly screwed it up.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Consider this question:

Which of the following are true?

(A) Coyotes are mammals.
(B) Koalas are mammals that live in Australia.
(C) Alligators are mammals.
(D) Penguins are birds that live in Australia.

Should we assume that "that live in Australia" should be applied to option A and C? Since after all, those options never specified whether they were in Australia or not? Should we assume that the most specific context (in Australia) should be applied to all answers? I don't think so. To me, A is obviously true, and C is obviously false; those answers are clear without trying to import context from other answers.
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
I just don't see how "single instance method", in common Java usage, means the same as "single method instance".

Physically, the bytecode for a method is shared among all class instances and the method's local variables and workspaces in the stack frame are unique to a method invocation (think recursive), not to a class instance.

A bigger issue is that there is no effective way to complain about errors and ambiguities in the live test. You are not allowed to take away any notes and the Prometrics employees can only put your comments into a daily report that may not even get to Sun. There is no feedback so who knows. I found three harmless but real errors in my live SCJP and I wasn't even looking.


Mike Gershman
SCJP 1.4, SCWCD in process
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sun Practice Exam has incorrect answer?