Guillaume Bailly

Ranch Hand
+ Follow
since Jan 18, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Guillaume Bailly

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.

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 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 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.
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
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
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

Manuel Trumm wrote:Chapter 6, Review question 14 D looks correct to me, although the answer says wrong. Anyone?


Notice that if class A is extended by B, then B is a subclass of A.

Manuel Trumm wrote:Chapter 1, Review Question 5, Option B:
The answer is marked as false. However, if the object created on line 9 is eligible for GC after line 13, isn't it then also eligible for GC after line 14? Or does the System.gc() is interpreted as: the object might have been GCed and therefore might not in all cases be eligible i.e. it might not exist?


Yes, you're right. The book assumes the most "restrictive" here (and if it's eligible for GC somewhere in the code, it will always be so later on in the same code).
Hi,

The following is just a suggestion for online question "tb864585.JaSE17SG.at.25"

The option H for line 12 of the program does not really make sense in my opinion and could be removed or changed to line 11 or something else.

Just my 2 cents.

Guillaume

Cristian Uceda Garrido wrote:
[...]
Chapter 6, Q.34:
[...]


Strange, Stream is in chapter 10 in OCP 17 Study Guide.
Are you sure you mean ch. 6 q. 34? (I can't find it anywhere)
I would like to help but...

Guillaume

Cristian Uceda Garrido wrote:
[...]By the way, should not it be parallel() instead of parallelStream()?[...]


parallelStream() is correct, as you have a List here.
parallel() can only be used on a Stream.
Hi,

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

Guillaume
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
Hi,

While I get the point behind the flashcard 'fc864585.JaSE17SG.1.049' in the online tool, it leads to confusion in my opinion (which might be on purpose).

It says "True or false? A switch expression is always required to have a default statement when assigning the result to an int value."
And then "True, since handling every possible int value would be untenable."

While the answer is correct on its own, I'm not sure it really answers the question.

Since we're talking about the result of the expression, the example below is how I see things, which is perfectly valid code.


Guillaume