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 61–70 of 181
  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70

Question 61

Multiple choice Using Text Files
Assume that info.txt contains the following: Hello World AP CSA Good Bye Consider the following code segment: File file = new File("info.txt"); Scanner scanner…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 62

Multiple choice Using Text Files
// Assume: File f = new File("data.txt"); // File contains space-separated integers…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 63

Multiple choice Using Text Files
A file numbers.txt contains one integer per line. Which code segment correctly reads all integers and finds the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 64

Multiple choice Using Text Files
Assume the file data.txt contains: 5 7 3 public static int readNumbers() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 65

Multiple choice Using Text Files
Assume the file data.txt contains: apple banana cat public static int countLines() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 66

Multiple choice Using Text Files
Assume the file data.txt contains: dog cat bird public static int totalLength() throws Exception { Scanner file = new Scanner(new File("data.txt"));…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 67

Multiple choice Using Text Files
Assume the file data.txt contains: 1 2 3 4 5 public static int countNumbers() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 68

Multiple choice Using Text Files
Assume the file data.txt contains: apple banana cat dog fish bird public static int count() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 69

Multiple choice Using Text Files
Assume the file data.txt contains: 4 7 2 9 5 8 public static int count() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 70

Multiple choice Using Text Files
public static int readNumber() throws Exception { Scanner file = new Scanner(new File("data.txt")); return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 61 of 181
Page 7 of 19