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 111–120 of 181
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Using Text Files
A text file contains: A B C D E. What is printed? String result = ""; int idx = 0; while (sc.hasNext()) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Using Text Files
A text file contains: 5 1 2 3 4 5. The first number indicates how many values follow. What is printed? int n =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Using Text Files
A text file contains: J a v a. What is printed? String result = ""; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Using Text Files
A text file contains: 1.5 2.5 3.0. What is printed? double sum = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Using Text Files
A text file contains: 10 3 5 2. What is printed? int result = 0; int idx = 0; while (sc.hasNext()) { int n = sc.nextInt();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Multiple choice Using Text Files
A text file contains: 5 3 5 5 2 5. What is printed? int count = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Using Text Files
A text file contains two lines: hello world What is printed? int count = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Using Text Files
A text file contains: hi hello hey. What is printed? int total = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Using Text Files
A text file contains: 5 1 8 3. What is printed? int max = sc.nextInt(); int second = sc.nextInt(); if (second > max) { int temp = max; max = second; second =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Using Text Files
A text file contains: true 7 3. What is printed? boolean flag = sc.nextBoolean(); int a = sc.nextInt(); int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 181
Page 12 of 19