*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on Practice Exams Book from K&B 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 "Question on Practice Exams Book from K&B" Watch "Question on Practice Exams Book from K&B" New topic
Author

Question on Practice Exams Book from K&B

Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

Hello ! Im having my exam on friday and currently working through the test exams in the KB Practice Book (damn those are hard, i barely have 50%) and im having a big doubt on the question #27 in Practice Exam #1

I dont know if its allowed to post code from the book, so im gonna try to tell you what its about.
Basically the Question is what is a legal use of following methods when in the superclass this exists: ;when FileNotFoundException extends IOException

Under the given choices i selected:



but solution tells me that only the 1st and 3rd are correct... why is that ? overloading shouldnt care, as well as throwing narrower exceptions ?

please help

Greetings


OCPJP 6 - 93%
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

damn the second i posted this i realized my mistake...


method main doesnt throw or catch thats why... damn this is gonna be tough
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

Torsten wrote:I dont know if its allowed to post code from the book

It is allowed to post codes from the K&B book here, imagine the caos it would cause if you cant see the codes you are debating on. , however your precaution is a good practice.

Torsten wrote:friday and currently working through the test exams in the KB Practice Book (damn those are hard, i barely have 50%)

I am NOT so convinced about your preparedness for the exams, however if you are convinced go for it, with the time you have left try and concentrate on the following topics (amongst others) in the K&B book:

1. Object Orientation(Chapter 2)
2. Generics AND Collections(Chapter 7)
3. Strings, IO, Formatting, Parsing(Chapter 6)

Half of the exam questions 'usually' comes from the above three, if you dominate them VERY well, I wonder why you wont make it.

I wish you the best!.

Regards

Ikpefua.


OCPJP 6.
In Your Pursuit Towards Certification, NEVER Give Up.
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

Well my Problem is that im kinda forced (cause of various circumstances) to take the exam before it moves to Pearson (june 1st)

Im quite good at Collections & Generics, i just hope that the real exam is easier than K&B Books. but i think i can do it

wish me luck
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Ikpefua Jacob-Obinyan wrote:
Torsten wrote:I dont know if its allowed to post code from the book

It is allowed to post codes from the K&B book here, imagine the caos it would cause if you cant see the codes you are debating on. , however your precaution is a good practice.

Torsten wrote:friday and currently working through the test exams in the KB Practice Book (damn those are hard, i barely have 50%)

I am NOT so convinced about your preparedness for the exams, however if you are convinced go for it, with the time you have left try and concentrate on the following topics (amongst others) in the K&B book:

1. Object Orientation(Chapter 2)
2. Generics AND Collections(Chapter 7)
3. Strings, IO, Formatting, Parsing(Chapter 6)

Half of the exam questions 'usually' comes from the above three, if you dominate them VERY well, I wonder why you wont make it.

I wish you the best!.

Regards

Ikpefua.


IMO the questions from this book are the toughest, tougher than Devaka's ExamLab, because in ExamLab you get exactly how many answers you are supposed to answer, but in the exam book not. So if Torsten manages to do a consistent 50% then he should go for it.

After all, its all 280 bloody euros, in worst case consider it a .... recreation vacation (or nightmare) which lasts only 3 hours


OCPJP 6.0
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

well if i pass my boss pays it otherwise i have to

but as i said, i really have no other choice then writing before june 1st

thank you for the motivating words
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Torsten Oppermann wrote:Well my Problem is that im kinda forced (cause of various circumstances) to take the exam before it moves to Pearson (june 1st)

Im quite good at Collections & Generics, i just hope that the real exam is easier than K&B Books. but i think i can do it

wish me luck


Same with me, pearson centers here in Greece are not fully aware of the switch and i will rush to take the exam before end of May.

Good luck to both of us...
Important thing is to get proper rest....

Generics are a mess, because one has to understand the core JLS regarding generics in order to *properly* know all the rules of them.

E.g. why



One has to read serious documentation about Generics, and IMO neither our beloved book, nor the online documentation i saw from SUN/Oracle covers all the syntax and all the semantics correctly.
Personally what i am gonna do, is base my reactions on intuition after having seen as many programs as possible, because there is no time for in depth studying for each chapter of its own.
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

i have read Bruce Eckels "Thinking in Java", especially the Generics part. My favourite book on Java so far
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

@Achilleas,
you are a Java guru. you have NO problems, my PERSONAL assesment of your knowledge tells me that on the exam day, while writing the exams you will have time to drink some coffee, coca-cola and even watch a comedy.

Now what I want to CONFIRM to you guys based on MY PERSONAL EXPERIENCE WITH THE REAL EXAMS is that the answer options are SPECIFIC just like examLab, if two are correct the will say 'Choose-Two'.

@Torsten,
you do NOT need to be a Generics and Collection 'guru' to make it, the exam creators know this, that is why I tell my coleagues in this forum to ALWAYS concentrate on what your-knowledge-is-being-tested-on, you are expected to know the basics like:

1.correct override syntax of the equals() method and the consecuences of an incorrect override

2.the HashCode Vs Equals contract.(If two objects are equal, their hashcodes MUST be equal).

3.hashSet, priorityqueue order are NOt defined.

4.correct implementation of Comparator and Comparable( compare() AND compareTo() methods)

5.elements of a sorted set MUST be comparable(or MUST implement comparable) and the consequence
of the contrary...'runtime exception!'

6.The basic rules of 'Generics' declaration syntax (wilcard '?' and 'super' are PROHIBITED)

7.The basic rules of 'collection' declaration syntax e.g 'List<?>' i... can be assinged anything but CANNOT be added elements, in other to add elements you MUST say 'List<? super T> i' and REMEMBER that the elements added are 'restricted' ONLY to 'type' 'T' and its 'SUBTYPES'.

8.Remember that Hashtable and Vector has synchronized methods.

9.Someone in this forum told me that in her exams recently she was asked the difference between ArrayList and LinkedList at this moment I remember that LinkedList are good when you want to add elements to 'beginnings & ends'.

Lets say you know MOST of what I have mentioned above herein, you a SURE to score at LEAST 80% in generics and collection.

I wish you guys the best of luck!.

Regards

Ikpefua.
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

thank you for your effort !

the thing about wildcards and super can really be tricky.

my understanding is, that i can use them for the reference but not an actual object:

is fine for isntance, but

is not, right ?

and i cant add Stuff to Collections with wildcards

Like:

and then say
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Jacob, thank yo a lot,

jesus!! guys sometimes we behave like we are in some ex-addict-anonymous group, helping our brothers and sisters and the like! its cool!
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Torsten Oppermann wrote:
and i cant add Stuff to Collections with wildcards

Like:

and then say


As Jacob said, aMethod has to return <? super Integer> in order to be able to add Integers, or things that ARE Integers (which means only Integers, since they are final )
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

Torsten wrote:
the thing about 'wildcards' and 'super' can really be tricky.


You are correct, you are VERY likely to come across 'drag-and-drop' questions that will DIRECTLY test your knowledge on this.

Now I advise you to take an hour or two to create the 'basic rules' that you MUST not forget. let me help you start by reminding you that when it comes to 'GENERICS', wildcards '?' and super behave DIFFERENTLY compared to 'COLLECTIONS'.

'collections' declaration basic rules:


Complete it from page 621 of the K&B book REMEMBER that these rules apply to anyplace 'assignment-operation' takes place like method parameters and method return types.
________________________________________________________________________________________

'generics' declarations basic rules:


I have saved you part of that 'hour or two'... Now complete the above codes(Page 621 K&B) and BURN-THEM-IN.
If you know all these basic rules, you will get good scores in this topic.
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

thank you so much Ikpefua

im gonna take the whole afternoon (soon work done for today ) and gonna learn those concepts

gonna post in here how it went tomorrow again, thanks a lot guys !
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

i think parsing, formatting and the whole jar/classpath thing is my biggest problem :/
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Torsten Oppermann wrote:i think parsing, formatting and the whole jar/classpath thing is my biggest problem :/


jar/classpath is ok if you have Unix experience, i score ok with them, but parsing/formatting ??? I think any question can easily kill me with parsing and formatting, Scanner, etc...

about jar, classpath, you can follow these guidelines :

1) a jar is a compressed directory. Putting a jar in your classpath, is like adding a new directory in your path. Think of it as it is already expanded.
2) think about the order in which you define the paths/jars in your classpath
3) and this is a big 3). DO NOT CONFUSE paths with PACKAGES !!!

A package is a fundamental concept in java, and if a class belongs to a package, its name is BOUND with the package forever!

Think of it, a PACKAGE ISA PATH but a PATH IS-NOT-A PACKAGE!!!

So, if a class SummerTime belongs to a package e.g. gr.foo.bar, then it is supposed to be found in gr/foo/bar/SummerTime.class
and also the root of the package location HAS to be in your path.

Now imagine that the directory gr/foo/bar/misc might not be a package so classes there can be named WITHOUT any package prefix (gr.foo....)
but their dir gr/foo/bar/misc must be in the path.

So in the package case the path containing gr/... must be in the classpath, while in the 2nd case the ACTUAL path must be in the classpath.
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

@Achilleas,
people with 'vast' knowledge like you are prone to falling into an UNBELEIVABLE 'trip-trap' like:



While you are trying to check whats going on with 'System Properties'...
Compilation fails in line 3 'illegal forward reference'
You MUST surround the code with an init block '{ }', or constructor, so watch out for exam TRIP-TRAPS

REMEMBER to always check FIRST whether a code is violating basic principles.
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Ikpefua Jacob-Obinyan wrote:@Achilleas,
people with 'vast' knowledge like you are prone to falling into an UNBELEIVABLE 'trip-trap' like:



While you are trying to check whats going on with 'System Properties'...
Compilation fails in line 3 'illegal forward reference'
You MUST surround the code with an init block '{ }', or constructor, so watch out for exam TRIP-TRAPS

REMEMBER to always check FIRST whether a code is violating basic principles.


come on man, i have no *vast* knowledge, please do not say this, lets keep it cool man
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

Torsten wrote:
i think parsing, formatting and the whole jar/classpath thing is my biggest problem :/


Achilleas wrote:
but parsing/formatting ??? I think any question can easily kill me with parsing and formatting, Scanner, etc...


Hello Guys,
I guess your day has started well...
@Torsten
about jar/classpath, for the purpose of the exams, you are 95% sure of your knowledge being tested on how to locate classes declared in packages using the javac and java commands. And how to locate .class files placed inside a jar file. you are likely going to get btw 4 to 6 questions from chapter 10. So if you have doubts let me know, so we crack-it-up.

@Achilleas,
let me know the EXACT spot where your 'confusion' is about parsing and formatting and we will crack-it-up...

The BEST way to resolve our doubts is to be sure that whatever we are doing should ALWAYS be oriented EXCLUSIVELY towards what you are likely to get in the exams, and thats where my 'two-time' experience comes into play.

I await your replies, lets-get-going.

Regards

Ikpefua.
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Ikpefua Jacob-Obinyan wrote:
@Achilleas,
let me know the EXACT spot where your 'confusion' is about parsing and formatting and we will crack-it-up...


It is just that the material is huge, the API is huge.
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

Achilleas wrote:It is just that the material is huge, the API is huge.


At first sight, it is huge, but when you know PRECISELY what your knowledge will be tested on,
then it will NOT be that huge, you said formatting and parsing is Huge.
(You remember the first time we argued? you accused me of being lazy, now its your turn)

Come on lets start some coding!

I PERSONALLY dont see anything 'huge' in formatting (For the purpose of the exams).

- moderator deleted reference to a purported "real question" -
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Thanks man!! fair enough !
I know the semantics of printf (being an old Unix/C junkie!)
but don't tell me that

is easy to guess that it outputs "foo bar" in the time of the final exam...
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

For the purpose of the exam, you are ONLY required to know 'format' NOT 'Formatter'. And the question will be simple and specific like the one I placed here.
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Thanks, man,
i'll just seat and pray (and study a little) and see how it goes. If i make it, i owe you one...if not, we will be here again together doing exercises again!
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

i passed the exam this morning see more details in the cert results forum

thanks so much again !
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

Congratulations!!
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Torsten Oppermann wrote:i passed the exam this morning see more details in the cert results forum

thanks so much again !

cool man! and with a high score ! well done!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on Practice Exams Book from K&B