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.

Questions 941–950 of 1,079
  1. 941
  2. 942
  3. 943
  4. 944
  5. 945
  6. 946
  7. 947
  8. 948
  9. 949
  10. 950

Question 941

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 942

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 943

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 944

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 945

Multiple choice Using Text Files
A text file contains: 2 -3 5 -1 4. What is printed? int pos = 0; int neg = 0; while (sc.hasNext()) { int n =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 946

Multiple choice Using Text Files
A text file contains: 1 2 3 4 5 6. The code reads every other value, skipping alternating tokens. What is printed? int sum =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 947

Multiple choice Using Text Files
A text file contains: apple,banana,cherry. What is printed? String line =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 948

Multiple choice Using Text Files
A text file contains: one:two:three:four. What is printed? String line =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 949

Multiple choice Using Text Files
A text file contains: 5,10,15. What is printed? String line = sc.nextLine(); sc.close(); String[] parts =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 950

Multiple choice Using Text Files
A text file contains: hello world from java. What is printed? String line = sc.nextLine();…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 941 of 1,079
Page 95 of 108