Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
21.1.1. Streams in Java
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
3 cards from this lesson. Good the night before a test.
Try these first
- 1.
What type of stream is best suited for reading binary data?
Hint
Think of raw data.
- 2.
Name a class used for writing character data.
Hint
It starts with 'F'.
- 3.
Which class is used to read bytes from a file?
- FileInputStream
- FileReader
- BufferedReader
Hint
Focus on the class that deals with bytes.
- 4.
True or False: Character streams are better suited for binary data.
- True
- False
Hint
Think about the types of data.
- 5.
Create a small program that reads a file using BufferedInputStream, counts how many bytes are read, and displays the count.
Hint
Focus on looping through the byte stream to count instead of reading into an array.
- 6.
Write a method that takes a filename as input, uses PrintWriter to append a line of text to the file, and handles exceptions.
Hint
Make sure to open the FileWriter in append mode.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting