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.
Multiple choice
Unit 4: Data Collections
Question 2622
Multiple choice
Unit 4: Data Collections
Question 2623
Multiple choice
Unit 4: Data Collections
Question 2624
Multiple choice
Unit 4: Data Collections
Question 2625
Multiple choice
Unit 4: Data Collections
Question 2626
Multiple choice
Unit 4: Data Collections
Question 2627
Multiple choice
Unit 4: Data Collections
Question 2628
Multiple choice
Unit 4: Data Collections
Question 2629
Multiple choice
Unit 4: Data Collections
A text file contains a single line:
42. What is printed by the following code? Assume sc is a properly constructed Scanner reading that file.
int x = sc.nextInt();
sc.close();
System.out.println(x + 8);
Pick an answer, then check it. The solution opens in a window.
ACorrect answer
Answer images
Question 2630
Multiple choice
Unit 4: Data Collections
A text file contains a single line:
Hello World. What is printed?
String s = sc.nextLine();
sc.close();
System.out.println(s.length());
Pick an answer, then check it. The solution opens in a window.
BCorrect answer
Answer images
Question 2,621 of 2,811
Page 263 of 282
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.

