• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Sybex OCA OCP Practice Test - Errata  RSS feed

 
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 1 - question 39: (page 13 and 431)

Answer D is correct, since the extension of a source file is .java.
But the explanation is incorrect:

The proper extension for a Java compiled bytecode file is .java


The extension of the compiled bytecode file is .class
 
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed the answer explanation is incorrect (luckily the answer was right). I've logged it in the errata. Thanks for noticing and reporting this.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 2 - question 27: (page 24 and 435)
Answer B is correct.
But the explanation to the incorrect answer C is strange:

C. You can convert a wrapper class object to a primitive by calling valueOf().


... because this method is used for converting to a wrapper class from a String ...


There is an overloaded Integer.valueOf( int i) which converts primitive to wrapper.
Therefore answer C is wrong because it converts primitive to wrapper, and not vice versa wrapper to primitive.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 2 - question 32: (page 25 and 435)
The explanation states:

A. Assuming the variables are not primitives ...


A String instance variable (variable containing a reference to a String object?) is never primitive, wrigth?
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 2 - explanation to question 47: (page 436)

Options A and B are static methods rather ...


A and B are incorrect method declarations, since the position of "static" between return type and method-name is wrong.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Juerg Bauman wrote:Chapter 2 - question 27: (page 24 and 435)
Answer B is correct.
But the explanation to the incorrect answer C is strange:

C. You can convert a wrapper class object to a primitive by calling valueOf().


... because this method is used for converting to a wrapper class from a String ...


There is an overloaded Integer.valueOf( int i) which converts primitive to wrapper.
Therefore answer C is wrong because it converts primitive to wrapper, and not vice versa wrapper to primitive.


There are two signatures of Integer.valueOf() - one takes a String which is the one the answer alludes to. The other takes a primitive. So neither convert a wrapper class to a primitive.

Remember that the practice tests book is designed to be used with/after a study guide for the exam. It covers the simplified view of the world that is on the OCA exam. For example, page 135 of our OCA book covers the valueOf method with Strings. It does not talk about using it for primitives. And that makes sense. There's no reason for the exam to ask you about calling valueOf to convert from a primitive to an object when you could just use autoboxing. This method was way more useful prior to Java 5.

In any case, we both agree the answer is B!
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Juerg Bauman wrote:Chapter 2 - question 32: (page 25 and 435)
The explanation states:

A. Assuming the variables are not primitives ...


A String instance variable (variable containing a reference to a String object?) is never primitive, wrigth?



Correct. That explanation is talking about the general case. It's a delicate balance writing explanations that both explain the question and are useful. Disagreeing on where that balance is doesn't make something an errata . Again, we both agree the answer is A.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Juerg Bauman wrote:Chapter 2 - explanation to question 47: (page 436)

Options A and B are static methods rather ...


A and B are incorrect method declarations, since the position of "static" between return type and method-name is wrong.


While this doesn't affect the answer, I agree it is an errata and have logged it in our errata list
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 450, explanation 31:

The outer loop decrements i i, making it 0.


There are too many i's int this line.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 456, explanation 32:

The class contains two constructors and one method.


It should be: The class contains one constructor and two methods.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Confirmed and logged both. Thanks.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 9 - question 22: (page 141)
a reference variable s is used without declaring its type. This question cannot be answered like that, one needs to know that s is of type String.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 475 - explanation 36:

Predicate is an interface with one method.


It should say: ... interface with one abstract method.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Juerg Bauman wrote:Chapter 9 - question 22: (page 141)
a reference variable s is used without declaring its type. This question cannot be answered like that, one needs to know that s is of type String.


That question is correct. The class that "s" is a type of has the methods contains(), equals() and startsWith(). How many classes did you learn for the OCA? I can only think of one.

Juerg Bauman wrote:On page 475 - explanation 36:

Predicate is an interface with one method.


It should say: ... interface with one abstract method.


True. I'll add it to our private list of things that could be clearer.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 9, question 22:

The explanation declares above line 3 as valid definition for a method, and therefore as correct answer.
This is incorrect since the terminal semicolon is missing.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38555
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Juerg Bauman wrote:On page 9, question 22:

The explanation declares above line 3 as valid definition for a method, and therefore as correct answer.
This is incorrect since the terminal semicolon is missing.


You don't need a semicolon for a method without any statements in it.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 11 - question 23: (page 197/489)

Option A is allowed because the turnOn() method is public and can be called from anywhere.


This is not correct. The class com.light.Flashlight has no access modifier (=package-protected) and is therefore not visible by any class in package com.dark.
The correct answers should be: A and C
 
Marshal
Posts: 60060
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can the class that method is in be subclassed as a public class? If so, can that method become accessible?
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 492 - explanation 14:

For these reason, Options A, C ...


typing error --> For these reasons ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 492 - explanation 15:

Finally, enum constructors must be private, meaning ...


The constructor for an enum type must be package-private or private access.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 505 - explanation #31:

B. The ToDoubleFunction interface takes a generic value, not a double value, making
Option D incorrect. It also uses the method name accept().


It should be: ... It uses the method applyAsDouble().
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 549, explanation #30:

Line 10 is incorrect.


The incorrect code is on line 9.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 537 - explanation 15:

If the code was fixed to use the correct method name, then it would complete without issue, ...


There is another error, since f.get() throws checked exceptions, which have to be caught or declared.
This doesn't affect the correct answer, which remains B.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 538, explanation #21:

The result is it may output 0, 1000, or anything in-between ...


Just a typo...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 538, explanation #23:

If count was marked static, then the application would sum the elements correctly, ...


The variable count is a primitive of type int and several threads are updating it. To avoid race condition it should be declared as AtomicInteger instead of int?
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 540 - explanation #33:

If push() had been used instead of offer() in the third loop, with new values being inserted at
the tail of the queue instead of at the head, ...


It's the opposite: If offer() had been used instead of push() ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 302 - question#4:

Which methods are classes that implement java.io.Serializable required to implement?


I'm not english native, but something is wrong with that sentence.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 304 - question#10:

For a given file, the absolute is the path from ...
... while the relative path is the path from ...


Typo: For a given file, the absolute path is the path ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 196 - question#21 (singleton pattern):
It's just a doubt, probably not an error.

It's about the instance variable which is not declared final. According to your Study Guide, instance should be static final (unless lazy instantiation).
Otherwise there is no method inside the class capable to reassign instance. I suggest you could loose some words in your explanation, that it is ok to omit the final keyword in this case.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 494 - explanation #29:

C. Dinosaur.new Pterodactyl();
...
Option C is incorrect. Pterodactyl is a member inner class, not a static nested class.


Option C is not working even for static nested classes. The correct syntax would be: new Dinosaur.Pterodactyl() or just new Pterodactyl()
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 504 - explanation #22:

The method reference is used for Supplier, not Consumer, since it takes a value and does not return anything.


It should be reverse: ... is used for Consumer, not Supplier, ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 345 - question #19: not an error, just a suggestion

I was surprised that this line actually did compile, because execute() takes a Runnable with return type void. The method getAnswer() has return type String.
The explanation: https://coderanch.com/t/690723/java/ExecutorService-execute-Runnable
Possibly I didn't get that fact earlier, maybe you could add it to your explanation.
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 523 - explanation#15:

Finally, because both can be used with a byte array, Option D is incorrect.


OutputStream uses byte[], while Writer uses char[].
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 361 - question#18:

Given the table books in the figure...
...
select * from cert where title = 'OCA'


It should be: select from books ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 542 - explanation#2:

... so the creators of the exam iare free to ...


just a typo
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 410 and 558 - question#49:

E. Two objects that return true for equals() will always return 0 when passed to compareTo().
...
Option E is incorrect because multiple comparators can use different orders for comparison, which do
not need to match the definition of equality.


The method compareTo() belongs to Comparable which is implemented on the class being compared.
There can be only one implementation, which should follow the contract: compareTo should return 0 if equals returns true.
So answer E should be true, but not always will...
By the way is " ... multiple comparators" meant with Uppercase Comparators?
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 561 - explanation#67:
there is a fourth error on line 12, since Function apply() takes just one argument, not two.
The answer remains correct: E
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 562 - explanation#80:

while any class that does not is unchecked and must be declared or handled.


It should be: ... does not is checked and must ...
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 496 - explanation#2:

Option C is incorrect because the replace() method is available on List, ...


There is no such method available in List, there is one called replaceAll().
 
Juerg Bauman
Ranch Hand
Posts: 74
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 452 - explanation#4:

... and trying to output a void return type in the print() method throws an exception at runtime.


The result is a compiler error, not an exception at runtime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!