Java Streams  «Prev  Next»

Java Input Streams - Quiz

1. Which one of the following statements about reading input streams is true?
Please select the best answer.
  A. When no bytes are available to be read, the available() method returns -1
  B. The InputStream class can never be instantiated directly
  C. All streams must be explicitly closed with the close() method
  D. read() returns a stream of bytes

2. The maximum number of bytes that can be skipped past in one method call is:
Please select the best answer.
  A. 32,767
  B. 2,147,483,647
  C. 4,294,967,294
  D. 9,223,372,036,854,775,807

3. What data type does the read() method return?
Please select the best answer.
  A. byte
  B. int
  C. long
  D. short

4. Which decimal number indicates end-of-stream?
Please select the best answer.
  A. 0
  B. -1
  C. 4
  D. 28