Win a copy of Fixing your Scrum this week in the Agile forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

OCP Java SE 11 Programmer Complete Study Guide (Sybex CSG 11) - Chapter 5 Review Question 7

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 7 is worded as follow: "Which of the following return the number 5 when run independently? (Choose all that apply.)" As it can be turned out from the solutions, "number 5" means "digit char '5' extracted from a string".

This is very problematic. Character '5' is just not the number 5. It's the number 5 for a toddler, but not for an experienced programmer, and not at all for the compiler. If we interpret it as a number, we convert it to the code point it represent which is 53.
 
Master Rancher
Posts: 1011
28
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
lol, I agree.  I think I remember back when I was on that chapter thinking "that isn't worded the way I would have said it".
I may have posted about it here, a lot of things I posted weren't taken as errata per se, but were marked as to be considered for future versions of the book.
i.e. maybe could be better worded, but vast majority of readers just "knew what it meant"...

int i = 5;
float f = 5.0f;
long L = 5L;
int five = 0b101


Now, those all ARE the number 5, even tho they all look a little different.

It reminds me of these two static methods on the Character class:
jshell> Character.forDigit(5, 10)
$22 ==> '5'

jshell> Character.getNumericValue(53)
$24 ==> 5
 
Dávid Horváth
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesse Silverman wrote:vast majority of readers just "knew what it meant"



Hm. However, this exam is all about tricky technical questions where you have to be a rationalist, and there is no room for any intuitive interpretation.

At the real exam, I would have given the wrong answer to this question, and I simply thought that this was the trick (a really silly one, apparently). Char '5' just couldn't be the number 5 in any way.
 
Jesse Silverman
Master Rancher
Posts: 1011
28
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I rather agree with you, tho I looked back and didn't complain about that one, I think.

On reviewing, I went too quick and failed to notice string.length() was missing the parenthesis.

I think I have a reputation here for getting stuck on tiny points of subtle detail.

In my defense, I can only say that I regularly get mock exam or end of chapter questions wrong that seem to be even more trivia or corner-case oriented than the things I am banging on about.
The level of precision required in something like the Java Language Specification is not necessarily required in a certification preparation book.

But as you imply, the mock exam questions sometimes seem they were written by snarky lawyers in a bad mood, and they are designed to accurately mirror the real exam questions.

I look forward to seeing if your complaints track my earlier ones closely or if we get bent out of shape over different items.

Either way, I can say that this journey has been proving to be of major value to me personally.  Countless Java-related mistakes I would have made in the past now jump out at me like glaring sign-waving entities shouting "Hey, I'm wrong!"

Possibly the largest value from the book(s) is that they have a pretty detailed knowledge of what is, and what is not, in scope for the exam.
When they say "Dude, that won't be on the exam!"  they are exceptionally likely to be correct.

For the record, several world-famous open documentation sets have changed places where in their examples, they referred to decimal digits as 'numbers' rather than 'decimal digits' upon my complaint.
I remember one not too long ago where they had described \d{3,5} in a regex as matching "3 to 5 numbers" -- ugh.

Onwards!
 
author & internet detective
Posts: 40709
827
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
I made a note to make this change in the next book.
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic