Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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 2,671–2,680 of 2,811
  1. 2671
  2. 2672
  3. 2673
  4. 2674
  5. 2675
  6. 2676
  7. 2677
  8. 2678
  9. 2679
  10. 2680

Question 2671

Multiple choice Unit 4: Data Collections
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 2672

Multiple choice Unit 4: Data Collections
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 2673

Multiple choice Unit 4: Data Collections
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 2674

Multiple choice Unit 4: Data Collections
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 2675

Multiple choice Unit 4: Data Collections
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 2676

Multiple choice Unit 4: Data Collections
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 2677

Multiple choice Unit 4: Data Collections
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 2678

Multiple choice Unit 4: Data Collections
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 2679

Multiple choice Unit 4: Data Collections
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 2680

Multiple choice Unit 4: Data Collections
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 2,671 of 2,811
Page 268 of 282