• 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

Questions/errata for Sybex OCP 17 Study Guide

 
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For online question tb864585.JaSE17SG.c09.15, I would suggest removing <Integer> on the left side and moving the type on the right side of the assignment.
This makes it clearer in my opinion that the blank refers to both the main type and the generics part.

Guillaume
 
Guillaume Bailly
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Question tb864585.JaSE17SG.c04.19 in the online test bank makes use of a static method in Arrrays (with three "r")
This is a minor concern, but I still wanted to add it for completeness.

Guillaume
 
Greenhorn
Posts: 4
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much.
I also get confused, because I think option b is a correct overloading, but not overriding.

By the way, Jeanne; where did you wrote that long explanation?. I'd be interested on read it. Thanks


Jeanne Boyarsky wrote:

Guillaume Bailly wrote:Hi,

Spoiler alert, this is a question about the review questions at the end of chapter 9.

I don't really get why option B in question 7 is seen as valid (pages 524 and 940).
After all, if I were to declare Alpaca as an interface, this wouldn't be true.

Can someone enlighten me?



I wrote a whole long explanation of why and then got to the end and realized it was wrong. Logged as an errata.

The quick test is to use an @Override tag and see if it is allowed. It is not.

 
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
VM: Welcome to the Ranch
 
Val Martinez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:VM: Welcome to the Ranch

Thanks Ritchie

Another question.
I become a bit confused while studying chapter 10.

In the table 10.10, (page 571) where most of Collectors methods are shown, the groupingBy says it reutns a Map<k, List<T>>.  And that is not totally true. For example,  you can program this



and each value of the map collected will be a Set (and not a List).
So, I would appreciate to use other Generic Type or info to describe more exactly the returned type of each groupingBy version.

Thank you.
 
Saloon Keeper
Posts: 15727
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the overloads of groupingBy() DOES return a Map<K, List<T>>. That there exist other overloads that return something different doesn't make the former fact any less true.

If that is the only overload that is listed in the table, then I agree that it seems arbitrary to only list that return value, and not others as well.
 
Val Martinez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:... If that is the only overload that is listed in the table..


Exactly!, that's the thing.

Cheking the official API helped me to understand there were others versions/overloads that return different types (ie,  groupingBy )
 
Master Rancher
Posts: 5060
81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of the overloads returns Map<K,List<T>>.

One does return a  Collector<T,?,Map<K,List<T>>>
 
Stephan van Hulst
Saloon Keeper
Posts: 15727
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, sorry, that's what I meant.
 
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.

I'm studiing for exam number 1Z0-829, using Sybex OCP 17 Study Guide.
I've already read the errata list of the book, but I still have concerns.

For example : Chapter 1, review questions page 55, question 5.
If an object is eligible for GC after line 13 (answer A), why saying it is also eligible for GC after line 14 is wrong (answer B) ?
Would the real exam say "...object become eligible for the first time after line..." ?

Regarding question 9, default value for primitive numerics is 0 (mathematical 0).
Will the exam ask to reply "0", "0.0", "0f", "0F" or "\u000", not simply "0" ? 0 will be wrong for everything but "int" ?

I Know I have to go back in my student shoes, proud of my sun developer certication (yes : sun !) !

Anyway, does any reader here find these questions interesting ?

Regards,
Hector

PS for Moderators.
As I'm new here, I hope I'm in the right place.
Feel free to confirme that to me, or to educate me !
 
Guillaume Bailly
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hector Beaujean wrote:For example : Chapter 1, review questions page 55, question 5.
If an object is eligible for GC after line 13 (answer A), why saying it is also eligible for GC after line 14 is wrong (answer B) ?
Would the real exam say "...object become eligible for the first time after line..." ?


I might have posted an answer for this question somewhere. Anyway, in such a case, you should assume the most restrictive. This is also the best way you (or the exam creators) can test your knowledge.
 
Guillaume Bailly
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hector Beaujean wrote:Regarding question 9, default value for primitive numerics is 0 (mathematical 0).
Will the exam ask to reply "0", "0.0", "0f", "0F" or "\u000", not simply "0" ? 0 will be wrong for everything but "int" ?


I passed the test recently, the exam creators are not that mean, no. There is also no real difference in the code, unless you format and print the value somewhere.
 
Hector Beaujean
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:

Hector Beaujean wrote:For example : Chapter 1, review questions page 55, question 5.
If an object is eligible for GC after line 13 (answer A), why saying it is also eligible for GC after line 14 is wrong (answer B) ?
Would the real exam say "...object become eligible for the first time after line..." ?


I might have posted an answer for this question somewhere. Anyway, in such a case, you should assume the most restrictive. This is also the best way you (or the exam creators) can test your knowledge.



Thanks for your reply.
I'm note sure of what you mean by

Guillaume Bailly wrote:the most restrictive

(excuse my english).

The question say "is eligible after line..." not "become eligible after line...".
In the real exam, I have to say "no, the object is not eligible for CG at this point" even if it is ?
If so, it's awkward for me...
 
Guillaume Bailly
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hector Beaujean wrote:The question say "is eligible after line..." not "become eligible after line...".
In the real exam, I have to say "no, the object is not eligible for CG at this point" even if it is ?
If so, it's awkward for me...



No no, you're right, and in that sense you could consider both options to be correct.
If it's eligible for GC somewhere in the code, it will always be so later on in the same code.
Hope it's clear now, otherwise let me know.

You can find my original answer here: https://coderanch.com/t/752987/certification/Errata-OCP-Developer-Study-Guide
 
Hector Beaujean
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:

Hector Beaujean wrote:Regarding question 9, default value for primitive numerics is 0 (mathematical 0).
Will the exam ask to reply "0", "0.0", "0f", "0F" or "\u000", not simply "0" ? 0 will be wrong for everything but "int" ?


I passed the test recently, the exam creators are not that mean, no. There is also no real difference in the code, unless you format and print the value somewhere.



In the book p9, the review question 6 says :
"A. An instance variable of type float defaults to 0.".
The answer to the review questions p911 says :
"A. is incorrect because float should have a decimal point.".

But :
, delault value is mathematical 0 (litetal to say that for float is 0f or 0F) and

I think quesion and/or answer have to be rephrase.

Do you agree ?
Should I propose an erratum ?
 
Guillaume Bailly
Ranch Hand
Posts: 90
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hector Beaujean wrote:In the book p9, the review question 6 says :
"A. An instance variable of type float defaults to 0.".
The answer to the review questions p911 says :
"A. is incorrect because float should have a decimal point.".

But :
, delault value is mathematical 0 (litetal to say that for float is 0f or 0F) and

I think quesion and/or answer have to be rephrase.

Do you agree ?
Should I propose an erratum ?



Well, when you look at option C, it's rather clear what is expected from the question. In this sense, option A remains a wrong option.
But I agree that the answer might have been a little bit more precise, it's true. A float defaults to 0.0f. Just saying a decimal point is required might not be precise enough.
Now, the fact that 0f compiles is because 0 is an int and an int can implicitly be cast to a float. This has nothing to do with default values.
 
Greenhorn
Posts: 9
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

There is a missing colon in Figure 3.3 (Chapter 3, Applying switch Statements - section). Here's an image depicting this report.


If the image isn't viewing inline over this post, you can actually see it at: (https://drive.google.com/file/d/1N0GjrnKdFyqDCK5sqIKkvI4HLX9vuO7s/view)



--
Caleb Josue Ruiz Torres
(https://www.calebjosue.com)
 
Caleb Josue Ruiz Torres
Greenhorn
Posts: 9
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 3 - The Switch Expression (Section).

Figure 3.4 (The structure of a switch expression). Is missing a required semicolon at the end of the Switch Expression.


Image:


Again, if the image isn't displaying inline (I am starting to think this has to do with the internal image viewer on Google Drive instead of being a link directly to an image).

Here's the image URL: https://drive.google.com/file/d/1CZjJ7CjAZTBNbK4pn0y_C2erqo3BHEMV/view

Thanks.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

on the page lvii in assesment test, in the question 30 is:
catch (Exception e || RuntimeException e)
and you mention: 'Finally, line 10 does not compile as RuntimeException is a subclass of Exception in the multi-catch block, making it redundant'
which is totally fine, but it seems that even that, the double argument inside ('e') is incorrect  - can be only one and logical OR || shouldn't be there.

--
Emil
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Emil Posmyk wrote:. . . the double argument inside ('e') is incorrect  - can be only one and logical OR || shouldn't be there.
Emil

I think that is correct

And . . . . . welcome to the Ranch
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:Hi,

For online flashcard "fc864585.JaSE17SG.1.025" with following content:

"Besides itself, which primitive types can be implicitly cast to double?"

I would add char to the answer (not a "natural" numeric type, but still holds true for completeness).

Guillaume


I would not. It's not a numeric type and too obscure for the exam.

Cristian Uceda Garrido wrote:Hi,

Chapter 6, Q.34:

I understand that there are no true good choices here as all of them are useless. It gets down to pick the least worse 2 options among them.

Valid solutions are B and E. I agree with E but not with B. I think they should be D and E.


I disagree D has a side effect. But as you noted, no good choices.

Guillaume Bailly wrote:Hi,

On page 624, the first paragraph in "Formatting Numbers" mentions a NumberFormat interface.
Actually, NumberFormat is an abstract class.

Guillaume


So it is. Adding to errata
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:Hi,

Regarding online question tb864585.JaSE17SG.c04.14, the answer mentions new Instant() as a valid option.
There is no public no-arg constructor for Instant actually, so this answer should be removed.

Guillaume



The book doesn't have B as correct. Will let the publisher know for the website
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:Hi,

Question tb864585.JaSE17SG.c04.19 in the online test bank makes use of a static method in Arrrays (with three "r")
This is a minor concern, but I still wanted to add it for completeness.

Guillaume


Arrrg. Also right in the printed book. I'll let the publisher know about the website. I'm wondering now if they uploaded an early draft of the book to the web!
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Val Martinez wrote:Thank you so much.
I also get confused, because I think option b is a correct overloading, but not overriding.

By the way, Jeanne; where did you wrote that long explanation?. I'd be interested on read it. Thanks


In a textbox on this forum. I didn't save/submit it because I realized while typing that my attempt at an explanation was wrong!
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Val Martinez wrote:

Stephan van Hulst wrote:... If that is the only overload that is listed in the table..


Exactly!, that's the thing.

Cheking the official API helped me to understand there were others versions/overloads that return different types (ie,  groupingBy )


Noted and will figure out what to do next edition
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Caleb Josue Ruiz Torres wrote:Hello there,

There is a missing colon in Figure 3.3 (Chapter 3, Applying switch Statements - section). Here's an image depicting this report.


Ooh. Good catch. Added to errata and credited you.
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Caleb Josue Ruiz Torres wrote:Chapter 3 - The Switch Expression (Section).

Figure 3.4 (The structure of a switch expression). Is missing a required semicolon at the end of the Switch Expression.


Image:


Again, if the image isn't displaying inline (I am starting to think this has to do with the internal image viewer on Google Drive instead of being a link directly to an image).

Here's the image URL: https://drive.google.com/file/d/1CZjJ7CjAZTBNbK4pn0y_C2erqo3BHEMV/view

Thanks.


Agreed and added to errata. Thanks for the annotated screenshots. Makes it super easy to see what's wrong in the diagram.
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Emil Posmyk wrote:Hello all,

on the page lvii in assesment test, in the question 30 is:
catch (Exception e || RuntimeException e)
and you mention: 'Finally, line 10 does not compile as RuntimeException is a subclass of Exception in the multi-catch block, making it redundant'
which is totally fine, but it seems that even that, the double argument inside ('e') is incorrect  - can be only one and logical OR || shouldn't be there.

--
Emil


This is true. It's already in the errata though.

I think I replied to everything in this thread now.
 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Guillaume Bailly wrote:Hi,

On page 624, the first paragraph in "Formatting Numbers" mentions a NumberFormat interface.
Actually, NumberFormat is an abstract class.

Guillaume


So it is. Adding to errata


Errataception here :-) - on the errata website it says page 525 for this above, which isn't even in chapter 11.
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wrong page number? Good grief!
And welcome to the Ranch
 
Emil Posmyk
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Emil Posmyk wrote:Hello all,

on the page lvii in assesment test, in the question 30 is:
catch (Exception e || RuntimeException e)
and you mention: 'Finally, line 10 does not compile as RuntimeException is a subclass of Exception in the multi-catch block, making it redundant'
which is totally fine, but it seems that even that, the double argument inside ('e') is incorrect  - can be only one and logical OR || shouldn't be there.

--
Emil


This is true. It's already in the errata though.

I think I replied to everything in this thread now.



I don't see it there. I was checking only here (I thought all correctly reported issues were there :-)):
https://www.selikoff.net/ocp17/

Thanks
Emil
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Regarding online question tb864585.JaSE17SG.c02.09, the answer mentioned is the code compiles successfully and provides output.
But, When I tried executing in IDE, it provides java: illegal character: '\u02c3', please me to understand, which is correct option.

 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please show us who don't have that book/site the whole question.
 
Chris Fo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Fo wrote:

Jeanne Boyarsky wrote:

Guillaume Bailly wrote:Hi,

On page 624, the first paragraph in "Formatting Numbers" mentions a NumberFormat interface.
Actually, NumberFormat is an abstract class.

Guillaume


So it is. Adding to errata


Errataception here :-) - on the errata website it says page 525 for this above, which isn't even in chapter 11.


Isn't this the place to give the feedback? Since it's not a new discovery but what was linked from errata page I didn't create a new thread but maybe I need for it to be seen?
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Guillaume Bailly wrote:For online question tb864585.JaSE17SG.c09.15, I would suggest removing <Integer> on the left side and moving the type on the right side of the assignment.
This makes it clearer in my opinion that the blank refers to both the main type and the generics part.


That would change what are testing here. var cares greatly what is on the right side.

Guillaume Bailly wrote:Question tb864585.JaSE17SG.c04.19 in the online test bank makes use of a static method in Arrrays (with three "r")
This is a minor concern, but I still wanted to add it for completeness.


rrr. It's right in the printed book. Weird. Reported as an online only errata
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Fo wrote:Errataception here :-) - on the errata website it says page 525 for this above, which isn't even in chapter 11.


Fixed

Chris Fo wrote:Isn't this the place to give the feedback? Since it's not a new discovery but what was linked from errata page I didn't create a new thread but maybe I need for it to be seen?


I read new threads and replies at the same time. I've just been busy
 
Jeanne Boyarsky
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Saranya Eswaralal wrote:Hi,

Regarding online question tb864585.JaSE17SG.c02.09, the answer mentioned is the code compiles successfully and provides output.
But, When I tried executing in IDE, it provides java: illegal character: '\u02c3', please me to understand, which is correct option.


You probably copy/pasted which gave you a mdash (smart dash) or the like. THere's no funky characters in the code.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

on Chapter 11, page 639, paragraph "Specifying a Locale Category",
The paragraph ends with this sentence:
"You should also know that calling Locale.setDefault(us) after the previous code snippet will change both locale..."

However, "us" in Locale.setDefault(us) is not defined in the previous code snippet.
I believe this should change to
Locale.setDefault(new Locale("en", "US"))

Thank you
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think the authors wanted you to impute a us variable of type Locale.
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
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