• Post Reply Bookmark Topic Watch Topic
  • New Topic

wrong question, wrong answer  RSS feed

 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can�t get any worse than this...
Which variables of the encapsulationg class, can an inner class access if the inner class is defined in a static method of encapsulating class?
Select 2 correct options
a All static variables
b All final instance variables
c All instance variables
d All automatic variables.
e All final automatic variables
The answer is a and e.
(Reproduced from a mock exam with exact words, spellings and punctuation.)
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can�t get any worse than this...

Which variables of the encapsulationg class, can an inner class access if the inner class is defined in a static method of encapsulating class?
God!, it'll take me few moments to digest the question, I still don't understand
 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Where did you get this question?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the exam is filled with questions like this..
just kidding hehe
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marlene, are you trying to scare people out of taking the exam?
For all those that Marlene, succeeded in scaring, don't worry test is not that tricky.
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say answer is a and e. Marlene: Are you saying that that is incorrect?
Thanks
Barkat
 
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm with Barkat: a and e seem to be the correct answers. The question is more subtle and tricky than you will probably find on the exam, but I don't see where it's actually wrong. The term "automatic variables" may be obscure to some - it means "local variables".
 
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Marlene is pointing out that the questions is nonsensical. For example, what is an "encapsulating class"?
Here's an assignement for you... re-word the question so that it asks the question correctly.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim and Barkat:
I think not. Can it access the final automatic variables defined in other methods of the "encapsulating" class?
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a second look at the term "encapsulating class" too. I hope exam will use generally accepted terms....
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mmm, I did overlook "encapsulating" vs. "enclosing". And Steve is right, "all automatic variables" should really add "of the enclosing method" in order for e to be correct. I should have noted that. Still, this sort of stuff is typical for online mocks. When Marlene says it can't get any worse than this, I was expecting a much higher level of wrongness.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Misery loves company. Thanks for your empathy or at least curiosity.
First of all, who ever heard of an �encapsulating class� of an inner class? Surely they meant �enclosing class�.
Then they couldn�t even spell the wrong word correctly. Look at the suffix. �tiong� A mixture of �tion� or �ing�.
Next they put a comma between the subject and the verb.
The question asks for variables of the enclosing class. But one of the correct answers is for variables of the inner class.
C has automatic variables. Not Java. Java has local variables.
Some of the options end with periods, some don�t. Inconsistent.
What a mess. Actually, it�s kind of funny.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim, thanks for the humor. A higher level of wrongness. No, I am just a little frustrated with buggy mock exams.
Oh, ho. I've always wanted to use one of those funny little red faces. Nah that's too extreme. Maybe just this one. And a little of this one. Okay. Now I feel better.
[ September 22, 2003: Message edited by: Marlene Miller ]
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marlene
Well, I think I read in some java books "automatic variable". And I would consider it purely bookish to say something is wrong just because the we don't use "auto" word in usual Java context. I don't intend to start a ethical debate, neither I want to say against any of the comments so far but somehow the question directly went into my mind without any doubts about what is being asked.
Also, if it says "automatic" variable then of course it has to be of that method. I don't think it is necessary to mention that. Is it?? The whole purpose of saying something is "automatic" or "local" is the lexical scope and thats it. Why we would get confused about does it refer to any "other" method's local variable?
Anyways, I forgot to mention that- even if I got the question correctly I couldn't only partially answer as inner classes always confuses me about accessibility issues
Regards
Maulin
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Maulin for your point of view.
 
Steve Lovelace
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why we would get confused about does it refer to any "other" method's local variable?

This is just logic. The question asks:
Which variables of the encapsulationg class, can an inner class access if the inner class is defined in a static method of encapsulating class?
variables of the encapsulationg class could mean two things: 1) the member variables of the enclosing class 2) all variables defined within the class, including its methods and nested classes.
Suppose the meaning taken is 1). Then answer e) is clearly wrong.
So then take the meaning to be 2). Well, well. It's wrong again.
Ergo, e) is always wrong.
Looking past the language of a question to guess what the author really meant is a bit dangerous when you're taking the exam - they mean precisely what they say in all cases, and you could mislead yourself.
This brings up something I've been wondering about. To what extent are non-native English speakers handicapped by the demand for precise interpretation of questions? This is not in reference to Maulin's English, by the way. There are obviously lots of non-native speakers taking the exam - I would even guess the framer of the question we are torturing to death is not a native speaker. I'm just curious - how does it affect people? Is this something the exam authors take into account?

Anyways, I forgot to mention that- even if I got the question correctly I couldn't only partially answer as inner classes always confuses me about accessibility issues

I feel your pain, Maulin. Witness, folks, how this obviously intelligent fellow is sorely afflicted by the unclean specifications of nested classes in this, our chosen and beloved language.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, give me the good old days of Java 1.0 before the language was polluted with these horrid inner classes!
 
author
Sheriff
Posts: 8955
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two incredibly important tangents from this technical thread...
1) Marlene, Congratulations on your 1000th post!!! I have this dread that you're secretly plotting world domination in the form of mock exams that will make Dan's look easy!
2) It's been said that Gosling points to inner classes as an example of a poorly thought out 'enhancement' to the language, and why they are so slow and careful to change it (the language), at this point.

Once again Marlene,,, CONGRATS!!
(Please go easy on us for the next 1000...)
-Bert
[ September 23, 2003: Message edited by: Bert Bates ]
 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Steve Lovelace:
To what extent are non-native English speakers handicapped by the demand for precise interpretation of questions?


I believe that non-native English speakers are somewhat of at a disadvantage when taking exams in English. That is why a few posts back, I ask a question if Sun gives extra minutes if you live in a country where English is not the native language.
Giving an extra minute, I think, would even things out. It could give the examinee extra time to digest what the examiner is asking. And this is nothing new. I remember when I took my Siebel certification, we were given an extra 30 minutes.
 
Steve Lovelace
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giving extra minutes sounds like a reasonable step. But I can also envision exam administrators complaining about the added complication, and the possibility of unfairness complaints from native speakers. I think that saying "look, you just have to learn the language" would be fair if the language in question were a reasonable one. English is just so danged difficult, it seems to be built out of irregularities. Someone told me once that the most regular language on earth is Turkish. So here's my proposal for making these exams absolutely fair: give them all in Turkish. I bet the percentage of Turkish speakers taking the exams is fairly small, and if anyone complains that they have an unfair advantage, we can make them do it in less time (but only a few minutes).
I'm actually proud of this solution, and I bet it has a better chance of being implemented than my excellent proposed revision of the nested class specification.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that the test is harder for people whose first langauage is not English, and I sympathize. Thing is, I think that any serious development requires frequent use of the API, which as far as I know is only available in English and Japanese. Which means that the ability to interpret English (or Japanese) is actually a legitimate part of a Java programmer's necessary skills in today's world, and thus it's "fair" for the SCPJ to measure this, to some extent anyway. If we want to rectify the unfairness, we'd need to change other things before the SCPJ, I think. For starters, there'd need to be more different translations avilable for standard Java documentation. How many should Sun pay for? It's always going to be unfair to whatever languages are left out, but Sun could go broke tranlating into every language on the planet. I would like to see more translations available though. And it might be nice if the SCPJ were available in Japanese too (assuming it's not currently); that would be a start.
The other thing to remember is that this discussion came from looking at a poorly-worded mock exam. Poorly-worded mocks are extremely common; I figure if I can make a reasonable guess what they really meant, that's better than many of the exams out there. Actual Sun exams are much, much more likely to use correct English and standard terminology. Well, some years ago they did refer to "a static inner class" on the SCPJ , but that's been fixed for some time, I think. So mock exams are generally not a good indicator of language issues; don't worry too much about this aspect of a mock exam.
And oh, yes - congratulations, Marlene!
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bert and Jim (at 8836 posts). Resolved - to take the SCJP exam before I reach 2000 posts. Resolved � to answer the posted question that is actually being asked and to try to answer in less than one screen full.
Thank you Steve for transforming this post into something useful � a consideration of the language hurdles for many. It only now occurs to me that non-native-English-speaking readers are used to converting something fuzzy into something meaningful, whereas I expect the text to make perfect and complete logical sense, word for word.
[ September 24, 2003: Message edited by: Marlene Miller ]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would be easier for the foreign speaker if we at least use a standard lexicon. It may not be clear to a non-English speaker the "encapsulating" really means "enclosing". The JLS does create a standard lexicon that I think we should all try to use.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!