Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 31–40 of 181
  1. 31
  2. 32
  3. 33
  4. 34
  5. 35
  6. 36
  7. 37
  8. 38
  9. 39
  10. 40

Question 31

Multiple choice Using Text Files
What does this code output for file: A-B C-D while (scan.hasNext()) { String[] parts =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 32

Multiple choice Using Text Files
Why can nextLine() return an empty string immediately…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 33

Multiple choice Using Text Files
File content: true false hello What happens with: while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 34

Multiple choice Using Text Files
Given a file names.txt with the following content: Cohen-Isabel Lee-Cindy Patel-Anisha Which code correctly…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 35

Multiple choice Using Text Files
File content: 5 10 15 What does this print? int sum = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 36

Multiple choice Using Text Files
File content: A B C D What happens? while (scan.hasNextLine()) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 37

Multiple choice Using Text Files
Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 38

Multiple choice Using Text Files
File content: John Doe What does this code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 39

Multiple choice Using Text Files
Each line is Name-Email-Age, with no hyphens inside fields. For the input shown, which prints only…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 40

Multiple choice Using Text Files
With Locale.US and positive averages, which prints the name with the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 31 of 181
Page 4 of 19