Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice questions on Data Collections, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Subtopic: Using Text Files Clear filter

Questions 51–60 of 181
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Multiple choice Using Text Files
Input contains integer scores80,90,100.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Multiple choice Using Text Files
Input Name-Age lines contain positive ages:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Multiple choice Using Text Files
Input Car-Price lines are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Multiple choice Using Text Files
Input is the single line a b c d.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Multiple choice Using Text Files
A text file named roster.txt has the following contents. Assume that the file contains no spaces. Cohen-Isabel Lee-Cindy Patel-Anisha Sanchez-Michael In the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

Multiple choice Using Text Files
info.txt contains exactly 2.5 Hello World. The file exists, opens successfully, and the enclosing method handles checked file-opening exceptions. What happens?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 57

Multiple choice Using Text Files
Does this method compile? Assume the imports are present. public void readFile(String filename){ java.util.Scanner scan=new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 58

Multiple choice Using Text Files
data.txt contains one line: Hello-World-AP-CSA. The file opens successfully and checked exceptions are handled by the enclosing method. What is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 59

Multiple choice Using Text Files
Consider the following method. public static void readFile(String filename) { File file = new File(filename); Scanner sc = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 60

Multiple choice Using Text Files
Consider the following code segment: public void readLines() { File myFile = new File("data.txt"); Scanner scanner = new Scanner(myFile); while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 51 of 181
Page 6 of 19