• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Sybex 816, contribution to errata of Java OCP 11 Programmer II Study Guide

 
Greenhorn
Posts: 13
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some issues not mentioned on https://www.selikoff.net/ocp11-2/ from Java OCP 11 Programmer II Study Guide:

page 200, 4rd sentence: The noneMatch() method also returns false because one matches. => 2 match. Although you could argue that one match would be enough to result in false, this would not be in line with sentence 2 "The anyMatch() method returns true because two of the three elements match"  
page 326, just above figure 6.9: Notice the new module zoo.tickets.discount => the newly introduced module here is named zoo.tickets.etech
page 362, first sentence of the section "Submitting Task Collections": The last two methods listed in Table 7.2 that... => that should be table 7.1
page 375: section title "Applying a ReentrantLock Interface" ReentrantLock is a class. I guess this should either be something like "Applying a Lock Interface" or "Applying the ReentrantLock Class"
 
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jos Roseboom wrote:. . . . one match would be enough to result in false . . . The anyMatch() method returns true because two of the three elements match . . .

Those two sentences don't actually contradict each other.

. . . ReentrantLock is a class. . . . "Applying the ReentrantLock Class"[/i]

I would say using a Lock object or a ReentrantLock object.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some more issues not mentioned on https://www.selikoff.net/ocp11-2/ from Java OCP 11 Programmer II Study Guide:

page 469, question 11: the questions mentions execution deleteTree("/storage"). This should be deleteTree(new File("/storage")).
page 473, question 22: ...created on line 15 => ...created on line 17
page 491, the tip: On the exam, when you see Files.resolve() => Path.resolve()
page 511, Walking a Directory with walk(), first sentence: Steam API => Stream API
page 514, table 9.6: nest.gif => wings.gif
page 525, question 18: the questions asks about possible results. If the directory consists solely of .java files, all files are printed. B is a possible answer.
page 607, question 7: stmt.executeQuery(sql) is called on a PreparedStatement. Since sql contains a bind variable, a SQLException is thrown. This still makes the correct answer F, but since the explanation did not mention throwing an exception, I guess the code should be stmt.executeQuery()
page 608, question 12, answer says whitelist, but should be blacklist? : The code checks a condition. If the condition is true, an exception is thrown to block the protected code. This seems the recipe for Blacklist, not for Whitelist (which checks on a condition to be true and only if so runs the protected code)

Those two sentences don't actually contradict each other.


They do not contradict, but the reasoning is not in line with eachother, which could be confusing.
 
author & internet detective
Posts: 42056
926
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


Jos Roseboom wrote:page 200, 4rd sentence: The noneMatch() method also returns false because one matches. => 2 match. Although you could argue that one match would be enough to result in false, this would not be in line with sentence 2 "The anyMatch() method returns true because two of the three elements match"  


They go with the example. There are three elements in the list. Two match; one does not. For noneMatch(), it is only true if exactly zero match. In this example, there is one that doesn't match. For anyMatch(), it is true if one or more match. In this example, there are two that match. This is why we used those particular numbers. We were explaining the example the paragraph immediately follows.So the reasoning is in line with the example. Definitely not an errata

Jos Roseboom wrote:page 326, just above figure 6.9: Notice the new module zoo.tickets.discount => the newly introduced module here is named zoo.tickets.etech


Agreed. Added to errata

Jos Roseboom wrote:page 362, first sentence of the section "Submitting Task Collections": The last two methods listed in Table 7.2 that... => that should be table 7.1


Agreed. Added to errata

Jos Roseboom wrote:page 375: section title "Applying a ReentrantLock Interface" ReentrantLock is a class. I guess this should either be something like "Applying a Lock Interface" or "Applying the ReentrantLock Class"


Agreed. Added to errata
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Jos Roseboom wrote:page 469, question 11: the questions mentions execution deleteTree("/storage"). This should be deleteTree(new File("/storage")).


Agreed. Added to errata

Jos Roseboom wrote:page 473, question 22: ...created on line 15 => ...created on line 17


Agreed. Added to errata

Jos Roseboom wrote:page 491, the tip: On the exam, when you see Files.resolve() => Path.resolve()


I would say just resolve() would a better fix. But yeah, definitely an errata!

Jos Roseboom wrote:page 511, Walking a Directory with walk(), first sentence: Steam API => Stream API


Hey! Where did the "r" run off to? (Good catch; added to errata)

Jos Roseboom wrote:page 514, table 9.6: nest.gif => wings.gif


Agreed. Added to errata

Jos Roseboom wrote:page 525, question 18: the questions asks about possible results. If the directory consists solely of .java files, all files are printed. B is a possible answer.


Technically no. The question suggests /animals/fluffy exists. Since in java a "file" could be a directory, it doesn't  print fluffy

Jos Roseboom wrote:page 607, question 7: stmt.executeQuery(sql) is called on a PreparedStatement. Since sql contains a bind variable, a SQLException is thrown. This still makes the correct answer F, but since the explanation did not mention throwing an exception, I guess the code should be stmt.executeQuery()


The question is about  what attack can be made on that code. Whether the code is right or not is not relevant to the answer. This is actually important for the exam. If you get a question on the exam that looks like it is about security, it is about security. Don't read into the question and get it wrong!

Jos Roseboom wrote:page 608, question 12, answer says whitelist, but should be blacklist? : The code checks a condition. If the condition is true, an exception is thrown to block the protected code. This seems the recipe for Blacklist, not for Whitelist (which checks on a condition to be true and only if so runs the protected code)


Since the book came out, people have been starting to move away from the terms whitelist/blacklist. So I'm going to use both the original terms and terminology I'm trying to adopt in my answer. (The exam was written before the recent BLM activity though so you should expect they will still use whitelist/blacklist.)

A whitelist/allow list specifies all the characters that are allowed. In this case, it is the characters 0-9. A blacklist/deny list specifies the characters that are not allowed. So if I said you can't use &^*, that is a blacklist.  The reason whitelist/allow list is the answer is because the characters typed in the code specify what is allowed. Remember that it isn't about the true/false which runs the code. It's about what the validation is looking for.

I think an alternate definition might help you:  "A whitelist/allow list fails validation if any unexpected characters show up. A blacklist/deny list fails validation is specific characters show up". It's good practice to fail/throw san exception when validation fails regardless of which type of validation is it.
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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
Also, have a cow for the detailed and useful errata reports!

And good luck on the exam.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,

thanks for your explanations and judging my findings.

There is one finding you didn't judge: https://coderanch.com/t/734474/certification/Sybex-Java-OCP-Programmer-II . Do you agree with the reply of Thomasz there? I've had some Enthuware questions that try to trick me into the difference of autoboxing/unboxing.

Also, have a cow for the detailed and useful errata reports!


Thanks. I've always loved cows.

And good luck on the exam.


Thanks. I passed the exam last Friday.



 
Campbell Ritchie
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations Please search for “Wall of Fame” and add your name.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Congratulations Please search for “Wall of Fame” and add your name.


Thanks. I found and did.
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Jos Roseboom wrote:There is one finding you didn't judge: https://coderanch.com/t/734474/certification/Sybex-Java-OCP-Programmer-II . Do you agree with the reply of Thomasz there? I've had some Enthuware questions that try to trick me into the difference of autoboxing/unboxing.


Yes. In fact Thomasz was quoting me.

And congrats on your pass!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more possible errata. Table 9.3, Path methods:

This should be or some other variant. I've checked and I cannot find the overloaded method that has no parameters. If correct, this could also apply to page 756 (Kindle edition), with paragraph that starts with "Deriving a Path with relativize()".
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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
Confirmed and added to errata.

Thanks for pointing that out Dario. Also, welcome to CodeRanch!
 
Dario Orescanin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne :-) I think I found another one, although its very minor. Once again, OCP 11, Kindle edition, index, page 1083 of 1094.

When we get to letter "S", we can see "steam operations, terminal operations". Obviously, it should be "stream" instead of "steam".
 
Campbell Ritchie
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was my fault; I have a very old computer worked by a steam engine.
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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
Dario,
Agreed on steam vs stream. It is already in the errata - page 511 in the printed book.
 
Dario Orescanin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

I wanted to point out that there seem to be two "steam" errors in the book. One on page 511 in printed book, as you pointed out (chapter 9) and the second one in the index (at least in Kindle version) - I was referring to the second one.

Also, it is possible I found another small error. Kindle version once again. Figure 6.10. The service locator module is shown on the diagram to be "zoo.tours.reservation" (reservation is singular here), but we see "zoo.tours.reservations" (reservations is plural here) being referenced everywhere else in text and in code. So I would say that the diagram should have "zoo.tours.reservations" as the module name.
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Dario Orescanin wrote:Jeanne,

I wanted to point out that there seem to be two "steam" errors in the book. One on page 511 in printed book, as you pointed out (chapter 9) and the second one in the index (at least in Kindle version) - I was referring to the second one.


The index is derived from the text. So I'll call it the same error.

Dario Orescanin wrote:JAlso, it is possible I found another small error. Kindle version once again. Figure 6.10. The service locator module is shown on the diagram to be "zoo.tours.reservation" (reservation is singular here), but we see "zoo.tours.reservations" (reservations is plural here) being referenced everywhere else in text and in code. So I would say that the diagram should have "zoo.tours.reservations" as the module name.


That's in the errata.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dario Orescanin wrote:One more possible errata. Table 9.3, Path methods:

This should be or some other variant. I've checked and I cannot find the overloaded method that has no parameters. If correct, this could also apply to page 756 (Kindle edition), with paragraph that starts with "Deriving a Path with relativize()".



Jeanne,
thank you for fixing this error in the errata. Probably in the errata for the Complete edition "table 9.3" should be "table 20.3".
 
Campbell Ritchie
Marshal
Posts: 80097
413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finding errata in the errata? Somebody else does that too

Welcome to the Ranch
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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
. Agreed. Missed that on copy/paste between the two errata pages
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
page 466, Chapter 8, question 3: the value of name after the instance of Eagle created in the main() should be : Adeline instead of: Matt => Option A is correct.
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok
Content minimized. Click to view
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 491, We should have "public Path relativize(Path other)" instead of "public Path relativize()".
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
page 480,  on the method //URI to Path, using Paths factory method. After public static, It should be "Paths" instead of "Path".  And the follow one should "toUri()" instead of "toURI"
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joel Kaze wrote:page 480,  on the method //URI to Path, using Paths factory method. After public static, It should be "Paths" instead of "Path".  And the follow one should "toUri()" instead of "toURI"

 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joel Kaze wrote:Page 491, We should have "public Path relativize(Path other)" instead of "public Path relativize()".

 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joel Kaze wrote:page 466, Chapter 8, question 3: the value of name after the instance of Eagle created in the main() should be : Adeline instead of: Matt => Option A is correct.

Content minimized. Click to view
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Joel Kaze wrote:page 466, Chapter 8, question 3: the value of name after the instance of Eagle created in the main() should be : Adeline instead of: Matt => Option A is correct.


This question is correct as written with Option B (Matt) as the answer. Here's aan example (minus the getter/setter.) Take a look at the explanation in  the book. It explains that Bird is not Serialiable o the code still runs the Bird constructor; making the answer Matt.

 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Joel Kaze wrote:Page 491, We should have "public Path relativize(Path other)" instead of "public Path relativize()".


Agreed. Added to the errata

Joel Kaze wrote:page 480,  on the method //URI to Path, using Paths factory method. After public static, It should be "Paths" instead of "Path".


Path is correct. The line in question: public static Path get(URI uri) is a method signature. Path is the return type. Which is correct. Path is an interface. Paths is a helper class

Joel Kaze wrote: And the follow one should "toUri()" instead of "toURI"


Agreed. Added to the errata
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
page 166-167 , Chapter 3, question 8: Something ist wrong! It seem option D should be correect and option F ist  incorrect at runtime.

 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joel Kaze wrote: Assessment Test, Question 1, Option A should also be correct one.

 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Joel Kaze wrote:

Joel Kaze wrote: Assessment Test, Question 1, Option A should also be correct one.


No. The question asks which CRUD operations are *not* allowed in an executeUpdate() statement. Delete SQL statements are allowed in executeUpdate().

 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Joel Kaze wrote:page 166-167 , Chapter 3, question 8: Something ist wrong! It seem option D should be correect and option F ist  incorrect at runtime.


D is incorrect. It prints out [3, 5,7] and the question asks about printing [7, 5, 3]. Option F is correct.
 
Greenhorn
Posts: 7
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 4 -> Working with primitive streams -> Summarizing Statistics:

"If the stream were empty we would have count and sum of 0. All the other methods would return an empty Optional""

This is wrong, calling summaryStatistics on empty IntStream doesnt have a single method to return an Optional.

getMin() -> returns Integer.MAX_VALUE if no values present
getMax() -> returns Integer.MIN_VALUE if no values present
getSum() -> 0
getCount() -> 0
getAverage -> 0.0
 
Joel Kaze
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Table 1.1 of Chapter 1 pages 21, it should be "yes" instead of "No" for final permitted modifiers of Anomymous class because I think that amonymous class are implicitly final. Hint: https://docs.oracle.com/javase/specs/jls/se6/html/expressions.html#15.9.5
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Javid Asgarov wrote:This is wrong, calling summaryStatistics on empty IntStream doesnt have a single method to return an Optional.


You are correct. I've added this to the errata. Thank you for noticing this. Have a cow!
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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

Joel Kaze wrote:In Table 1.1 of Chapter 1 pages 21, it should be "yes" instead of "No" for final permitted modifiers of Anomymous class because I think that amonymous class are implicitly final. Hint: https://docs.oracle.com/javase/specs/jls/se6/html/expressions.html#15.9.5


Anonymous classes are implicitly final though. The table is about what modifiers you can type. And since you don't type "class", it doesn't make sense to declare it final or abstract explicitly.
 
Greenhorn
Posts: 1
1
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

Javid Asgarov wrote:This is wrong, calling summaryStatistics on empty IntStream doesnt have a single method to return an Optional.


You are correct. I've added this to the errata. Thank you for noticing this. Have a cow!



It seems that the errata text swapped the values:

getMin() and getMax() return MIN_VALUE and MAX_VALUE respectively.



as originally put  

Javid Asgarov wrote:
getMin() -> returns Integer.MAX_VALUE if no values present
getMax() -> returns Integer.MIN_VALUE if no values present


 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
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
Fixed. Thanks for noticing; I gave you a cow. (I'm less careful with the errata than the book)
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic