• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RHE - I/O Chapter Based Test

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

TIA,
- Manish
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Regards,
Manfred.
 
I love a good mentalist. And so does this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic