• 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:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Possible Errata Chapter 9 (Java OCP 8 Programmer II Study Guide, Sybex)  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Test for Chapter 9 (1Z0-809) - Question 3.

I think that the correct option is B and D because Files.readAttributes throws a checked exception and there is no catch block or we cannot see the throws at method level.

Is that right?

----

Chapter 9 - Question 5

Files.createDirectory(path.resolve("joey");

createDirectory throws a checked exception so the correct answer is E and not B,C,D.

Maybe the question should be more specific about that code compiles or something like that.

----

Chapter 9 - question 7

D,E should be correct, Files.isSameFile throws IOException and Files.createDirectory throws IOException as well...

There is no catch block or throws...

----

Chapter 9 - Question 11

Same k3 throws IOException.

----

Chapter 9 - Question 17

toRealPath throws IOEXception so B should be valid

Thanks,
Regards,
Gerard.


(This post originated in the K&B7 errata thread)
 
Sheriff
Posts: 11604
178
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gerard Ribas,

First of all, a warm welcome to CodeRanch!

Gerard Ribas wrote:Test for Chapter 9 (1Z0-809) - Question 3.
Chapter 9 - Question 5
Chapter 9 - question 7
Chapter 9 - Question 11
Chapter 9 - Question 17


I agree with you about the checked exceptions being thrown from these methods. But did you have a look at the assumptions mentioned on the exam topics tab of the official OCPJP8 certification exam page? Here is the text fragment I am referring to

Assume the following:
* Missing package and import statements: If sample code do not include package or import statements, and the question does not explicitly refer to these missing statements, then assume that all sample code is in the same package, and import statements exist to support them.
* No file or directory path names for classes: If a question does not state the file names or directory locations of classes, then assume one of the following, whichever will enable the code to compile and run:
  - All classes are in one file
  - Each class is contained in a separate file, and all files are in one directory
* Unintended line breaks: Sample code might have unintended line breaks. If you see a line of code that looks like it has wrapped, and this creates a situation where the wrapping is significant (for example, a quoted String literal has wrapped), assume that the wrapping is an extension of the same line, and the line does not contain a hard carriage return that would cause a compilation failure.
* Code fragments: A code fragment is a small section of source code that is presented without its context. Assume that all necessary supporting code exists is present and that the supporting environment fully supports the correct compilation and execution of the code shown and its omitted environment.
* Descriptive comments: Take descriptive comments, such as "setter and getters go here," at face value. Assume that correct code exists, compiles, and runs successfully to create the described effect.


If you look at the Code fragments assumption, it applies to these code snippets. Based on this assumption, you can assume that all necessary throws clauses and/or catch handlers do exist and therefore all these code snippets compile successfully and you don't have to consider the checked exceptions not being handled-or-declared while answering the questions. So the answers given in the study guide are spot-on and don't need to be changed.

Hope it helps!
Kind regards,
Roel
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!