Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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,961–2,970 of 3,140
  1. 2961
  2. 2962
  3. 2963
  4. 2964
  5. 2965
  6. 2966
  7. 2967
  8. 2968
  9. 2969
  10. 2970

Question 2961

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 2962

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 2963

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 2964

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 2965

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 2966

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 2967

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

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

Multiple choice Unit 4: Data Collections
A text file contains two lines: Name,Score Alice,95 The first line is a header. What is printed? sc.nextLine(); // skip header…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2970

Multiple choice Unit 4: Data Collections
A text file contains: 2.5-3.5-4.0. 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 2,961 of 3,140
Page 297 of 314