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.6. Working with Binary Files
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 is the primary difference between text files and binary files?
Hint
Think about the readability of the files.
- 2.
What class do you use in C++ to write binary files?
Hint
Consider how files are opened in C++.
- 3.
What are binary files primarily used for?
- Storing plain text data
- Storing images and audio
- Data logging
Hint
Think about formats that aren't easily represented in text.
- 4.
True or False: Binary files contain readable characters.
- True
- False
Hint
Recall the definition of binary vs text.
- 5.
Write a C++ program that prompts the user for 5 integers, stores them in a binary file, then reads them back and displays the values.
Hint
Use loops for input and proper stream methods for output.
- 6.
In Python, write a program that accepts a list of floats, writes them to a binary file, then reads the file contents into a list and calculates the average.
Hint
Consider how to convert between types when writing and reading.
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