• 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

Seriously?

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just started doing a practice exam. This is one of the questions:

Assuming in and out are properly defined and instantiated InputStream and OutputStream objects, respectively, which are true statements about the following code snippet? (Choose all that apply.)

Answer is

The code does not compile because the offset parameter is missing on line 5..... If the method signature on line 5 was changed to out.write(buffer,0,lengthRead), then the code would compile and run without issue

If we are supposed to know the exact signature for this method, why not for every method in the InputStream class. And if for every method in the IS class, why not for every method in OutputStream. And then, why not every method in BOS, BIS, FOS, FIS, Writer, Reader, BW, BR, FileWriter, FileReader, PrintStream, PrintWriter, , OOS, and OIS?
And then, for every class in the Collections API.
And then, for every class in java.util.concurrent.
And then, for every class in Files, every String method, every StringBuilder method.

Hmmph.



 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that we ask you to quote you sources. That question is from the Sybex OCP practice exam.s

Writing questions is tough. And often a judgment call. I'd say you probably don't need to know that. However, the question does point you to lines 3 and 5 for further inspection. It's not reams of code. I think the question is intending to focus on the buffer being reusable rather than memorizing the API.
 
Steven Squeers
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK yes, I get that. Sorry - it was just maybe the 2nd or 3rd question in a bank of 60 that I was taking, and so I thought, OMG, if they are all as bad as this I'm in real trouble.
But that was really the only one that I'd say was a bit...out there.

 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steven Squeers wrote:OK yes, I get that. Sorry - it was just maybe the 2nd or 3rd question in a bank of 60 that I was taking, and so I thought, OMG, if they are all as bad as this I'm in real trouble.
But that was really the only one that I'd say was a bit...out there.


Yeah. It's hard to write hundreds of questions without having a few that are, well like that.

That's true on the real exam too. It's not unheard of two see one or two weird questions. Often you can figure out the answer with educated guessing/testing taking strategy in those cases. For example, there was an obscure fact on a question. I wrote the question number on my "marker sheet." Another question used that same method but in a way I knew whether it was right/wrong.
reply
    Bookmark Topic Watch Topic
  • New Topic