• 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

some odd answers from the K&B CD - part 3

 
Ranch Hand
Posts: 50
Android Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another cup of my favourite answers! This is question #53 from the first exam in K&B's CD.
The question presents a series of conditions over some object instances of unknow type, named x1, x2, x3, x4, x5 and x6. I'll skip the irrelevant stuff and post an equivalent question:


Given:
...
x5.equals(x6) == true
...

Which of the following statements will always be true? (Choose all that apply):
...
x5.hashCode() == x6.hashCode()
...



That answer was considered the correct and the others were all incorrect. But either the question is formulated wrongly or the answer is not correct.

We can clearly have a class where two equal objects have different hashCodes:



So the question should have rather been: "Which, according to the hashCode contract, should be always true?".Some questions are extremely picky on its language and others are leaving so much up to supposition. Not fair!
 
Ranch Hand
Posts: 808
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Schubert wrote:So the question should have rather been: "Which, according to the hashCode contract, should be always true?".Some questions are extremely picky on its language and others are leaving so much up to supposition. Not fair!



I have to tell you, it is very reassuring to see someone else expressing the reactions I had after taking the mock exams. If it helps, I don't remember anything on the exam even remotely approaching the level of ambiguity we find in some of the mock questions.
 
John Schubert
Ranch Hand
Posts: 50
Android Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dennis Deems wrote:If it helps, I don't remember anything on the exam even remotely approaching the level of ambiguity we find in some of the mock questions.



It helps
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

On the one hand, I think the question should be worded better...

On the other hand, I think you're going overboard a bit. In the old days the real exam might have tried to "trick" you like that, but it's just not that way any more. The exam does sometimes focus on important details, but not in a "tricky" way. Perhaps you've looked at other mock exams that rely on tricks? The real exam focuses on important stuff, it doesn't rely on tricks.

hth,

Bert
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic