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.

Questions 1,031–1,040 of 1,222
  1. 1031
  2. 1032
  3. 1033
  4. 1034
  5. 1035
  6. 1036
  7. 1037
  8. 1038
  9. 1039
  10. 1040

Question 1031

Multiple choice Using Text Files
A text file contains: cat bat hat dog mat. What is printed? int count = 0; while (sc.hasNext()) { String s =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1032

Multiple choice Using Text Files
A text file contains: 10 20 30. What is printed? int sum = 0; int count = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1033

Multiple choice Using Text Files
A text file contains: 10 20 40. What is printed? int sum = 0; int count = 0; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1034

Multiple choice Using Text Files
A text file contains three lines: a b c d e f What is printed? int count = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1035

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 1036

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 1037

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 1038

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 1039

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 1040

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 1,031 of 1,222
Page 104 of 123