• 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

Right view on questions

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I practised the two scjp6 MasterExam's that come on cd with the K&B 6 book. At several questions I had the idea some answers were a bit ambiguous. Did anybody else had problems with this? It might be because English is not my mother language, although it's not too bad either. Or perhaps it's just the way I look at the questions. Maybe, when I see code, I should seek for traps, and when I see questions like 'what is true', I should go for the answers that are 'generally' true. Maybe somebody has some tips for me?

Here are some examples I had problems with, there were some more:

A: When an object is serialized, if it has references to other objects, those objects must be serializable. [REF: question 30 exam B]
B: The . character searches for letters. [REF: exam A]
C: is-a relationships always rely on polymorphism.
D: When using the java command, only files ending in .class can be executed [REF: question 66 exam B]
E: If your class implements Comparable but you don't explicitly override Comparable's method, collections will be sorted in natural order. [REF: question 54 exam B]

A is supposed to be true, but I didn't check it, because of transient variables.
B is supposed to be false, but I thought it was true. Hey, I know it searches more than letters only.
C should be true, I don't quite understand the sentence (has to do with my English I guess).
D is true. I thought, what about .jar files? Ok .. they consist of .class files that are executed...
E is not true. But I was thinking, what if I extend Integer. My SubInteger class implements Comparable, right? But I didn't explicitly override compare().

At another question, I had to check what was NOT possible. Here, I also had to check 'The code does not compile' and 'An error occurs at runtime'. Ok, maybe I should have checked the former, but how can one know that an error cannot occur at runtime? (what about OutOfMemoryError?).
 
Ranch Hand
Posts: 48
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Out of memory should be at runtime as its at the runtime when we know we cant allocate required amount of memory.

FOr the first one I think its true.
I really did not understand what you meant by is-a relies on polymorphism!

I request you to write the full sentences without any assumptions..
 
John Sutt
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There wasn't more text in the answer. The question was just
'check what is right' and one of the answers was 'is-a relationships always rely on polymorphism.'. Sorry I didn't put the question number here.

I also encountered this one in the free bonus exam you can download in the MasterExam installation menu (master exam scjp part C, question 4).

The question is: Which statement(s) are true, choose all that apply:
D: Has-a relationships always rely on instance variables.

The answer states that D is correct, while I read (and thought so myself) at another question that an has-a relationship is perfectly possible with a class variable as well.

I really like these exams, though, don't get me wrong. I've learned a lot by doing them.
 
Saurabh Patil
Ranch Hand
Posts: 48
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok now I can understand something.
I am just trying to help you out and following opinions do need a review.

-> Is-a relationship relies on polymorphism.

I would like to modify it a bit and say is-a relationship relies on inheritance...which is more correct. You can have the is-a relationship only through extends keyword. SO this is correct.

-> has-a relationship relies on instance variables.

Perfect! There shoudn't be any doubt in it. When you say "has-a" it means an object is inside another object.. like a car has a wheel..so car object has a wheel object - here wheel object is the instance of class wheel. There is no other way to do it! You said it can be possible to have class variables for has-a ..can you please provide an example..? We can discuss then....

I hope my opinions give you more understanding..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic