4. Data Collections
Using Text Files — Quiz
Test your understanding of using text files with 5 practice questions.
Practice Questions
Question 1
What is a text file most commonly used for in a program that works with collections of data?
Question 2
Which Java class is commonly used to read text files line by line in AP Computer Science A?
Question 3
When a program reads a text file into an array or an $ArrayList$, what is usually the first step before storing the data?
Question 4
Why might a programmer choose an $ArrayList$ instead of an array when working with data from a text file?
Question 5
A file contains one student's name on each line. After reading the file with a $Scanner$, which code pattern most likely processes each line until the end of the file?
