File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes RHE - I/O Chapter Based Test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "RHE - I/O Chapter Based Test" Watch "RHE - I/O Chapter Based Test" New topic

RHE - I/O Chapter Based Test

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

This is question 6 from RHE I/O Test (Chapter 13, page 471)

What does the following code fragment print out at line 9?

The answers given are (Choose only one type radio buttons)-
A) The output is i = 30.
B) The output is i = 20.
C) The output is i = 10.
D) There is no output because the code throws an exception at line 1.
E) There is no output because the code throws an exception at line 5.

But the code is not included in the try-catch blocks, so it will not compile,
Do we have to assume that the code is included in the try-catch block?
I ask this because in the previous qusetion of the same test,
the code is enclosed in the try-catch block.
Do I have to make a similar assumptio in the actual exam, since "Code will not compile"
option is not there in the answers? I have looked it in the RHE errata, but
there's no explanation available for this one.
Also, the semi-colon is missing on line 8, but I think it's only a typo and in the
actual exam, I hope that we will not be tested for its presence for compilaltion,
all other things being correct.

- Manish
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
HI Manish,
The important thing is to read the question VERY carefully. This is extremely important during the exam. In this case, the question says: code fragement no compilable, complete program. Since we are dealing with a code segment we need to assume that code not shown is present and is not important to finding the answer. The exam will use similar questions but I think will say something like: assuming the code will compile in the context in which it will be used ...
Also, the text is multiple choice. Therefore, get used to looking at the answers in developing your thoughts. If the semi-colon was not a typo wouldn't one of the answers be won't compile? If the try catch issue was an issue wouldn't one of the answers be won't compile?
The exam is meant for people to think through problems because that is what real-life programming is all about. The answers might not be obvious at first glance, but a little investigation will reveal the results.
NOTE: The exam won't have ANY typos because the questions have been investigated to the fullest to be clear precise.
I agree. Here's the link:
subject: RHE - I/O Chapter Based Test
It's not a secret anymore!