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 621–630 of 1,079
  1. 621
  2. 622
  3. 623
  4. 624
  5. 625
  6. 626
  7. 627
  8. 628
  9. 629
  10. 630

Question 621

Multiple choice Recursion
Consider the following recursive method: public static void smile(int n) { if (n == 0) { return; } for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 622

Multiple choice Recursion
Consider the following recursive method: public static void smile(int n) { if (n == 0) { return; } for (int k = 1; k <= n; k++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 623

Multiple choice Arraylists
Consider the following incomplete method, which shuffles a list of Card objects so that any card can end up at any index in the list deck, with equal…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 624

Multiple choice Arraylists
The method addStars is intended to append "*" at the end of each string in the ArrayList<String> words. Which of the following implementations of addStars will…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 625

Multiple choice Arrays
Consider the following method: public boolean examine(String[] letters) { int count = 0; for (String letter1 : letters) { for (String letter2 : letters) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 626

Multiple choice Arraylists
public class APTestResult { private String subject; private int score; public int getScore() { return score; } // constructor and other methods not shown }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 627

Multiple choice Arrays
What is printed when the following code segment is executed? String[] xy = {"X", "Y"};…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 628

Multiple choice 2D Arrays
Suppose m is a two-dimensional array of size 4 by 4, with all its elements initialized to zeros. The method fill is defined as follows: public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 629

Multiple choice Sorting And Searching
Consider the following method: /* * Returns the number of zeros in s. * Precondition: s.length() = 31; s consists of several * '0's followed by several '1's *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 630

Multiple choice Recursion
Consider the following method: public String encrypt(String word) { int pos = word.length() / 2; if (pos >= 1) { word =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 621 of 1,079
Page 63 of 108