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

interview test

 
Marshal
Posts: 79986
399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going to make things really difficult and assert that writing "ConceptA" in the toString method is a bug.
I challenge you to explain why I made that assertion.

I am also going to be awkward about names:
The naming of the classes Concept, Concept1, ConceptA, etc., is at best confusing and at worst a hazardous bug. I also think the names of the packages are misleading.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used my own naming convention..i have corrected the errors in the code which was sent by the interviewer.
a)original code which was sent by interviewer:
b)the code i have corrected is as below
can you please have a look at code (b) above and let me know if the code is correct?
 
Campbell Ritchie
Marshal
Posts: 79986
399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sujesh Katri wrote:I used my own naming convention . . .

Very bad idea. An employer will expect you to use their code conventions. Using your own naming conventions means you will write code which other programmers cannot understand.

As Joanne has explained several times lines 24-27 are incorrect.
You should consider the use of getClass() in the equals method. Even I am coming to the belief that it is implicitly incorrect.
As I have already said, the use of those String literals in the toString method is (in my opinon) poor style.
Using a raw type in lines 76/82 is incorrect.
Returning an Iterator is dangerous.
Why are you counting supertypes? That sounds like something from non‑object‑oriented programming. You should have got them to explain that before you went anywhere near your method. And I can think of a better way to run that loop.
The nest serial number method does not return the next serial number.
 
sujesh Katri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my system only i used my own naming convention...code (b) was the answer code which i sent to the interviewer...i used their given names while sending the answer.
 
Campbell Ritchie
Marshal
Posts: 79986
399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what about the other points?
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic