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.
13. File Handling
This section
Practice test
9 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
2 cards from this lesson. Good the night before a test.
Try these first
- 1.
What is a file?
Hint
Think about where your documents are stored on your computer.
- 2.
Name two types of files.
Hint
What kind of files can you read easily versus those you can’t?
- 3.
What does the 'r' mode mean in file operations?
- Read-only
- Write
- Append
Hint
Consider whether this mode allows you to change the file.
- 4.
True or False: A binary file is human-readable.
- True
- False
Hint
Think about how you'd access the data in a binary file.
- 5.
Write a program in Java that reads a text file and counts the number of lines in it.
Hint
Use 'readLine()' method for line-by-line reading.
- 6.
Using Python, create a binary file to store integer values from 1 to 10 and read them back to display.
Hint
Remember to handle... all modes properly when working with binary files.
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
3 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
Get your answers marked and your progress tracked
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