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. Java I/O and NIO
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
4 cards from this lesson. Good the night before a test.
Try these first
- 1.
What are byte streams used for?
Hint
Think about the type of data.
- 2.
List one example of a character stream class.
Hint
Consider classes dealing with text.
- 3.
Which of the following is a byte stream class?
- FileReader
- DataInputStream
- BufferedReader
Hint
Remember the classes that handle binary data.
- 4.
True or False: Java NIO is only useful for small files.
- True
- False
Hint
Think about the advantages of NIO.
- 5.
Create a Java program that uses NIO to watch for changes in a specified directory and print out the type of event that occurs.
Hint
Focus on setting up the WatchService and registering the directory.
- 6.
Design a system that utilizes memory-mapped files to manipulate a large dataset efficiently. Outline your approach and show code snippets.
Hint
Plan mapping the file and think about data manipulations on that mapped buffer.
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