Question Bank · Unit 4
AP® Computer Science A Data Collections Practice Questions
Work through AP Computer Science A practice 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.
All 1,222
Multiple choice 1,079
Free response 143
Subtopic: Recursion
Clear filter
Consider the following recursive method. public static void stars(int num) { if (num == 1) { return; } stars(num - 1); for (int…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. public static int calcMethod(int num) { if (num == 0) { return 10;…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following recursive method. public static boolean recurMethod(String str) { if (str.length() <= 1) { return true; } else if (str.substring(0,…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. public static void showMe(int arg) { if (arg < 10) { showMe(arg +…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following recursive method. public static void whatsItDo(String str) { int len = str.length(); if (len > 1) { String temp…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following recursive method. /** Precondition: num >= 0 */ public static int what(int num) { if (num < 10) { return 1; } else { return 1 + what(num…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. /** Precondition: 0 < numVals <= nums.length */ public static int mystery(int[] nums, int v, int numVals) { int k = 0; if (v ==…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. // precondition: x >= 0 public void mystery(int x) { if ((x / 10) != 0) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following recursive method. public static String recur(int val) { String dig = "" + (val % 3); if (val / 3 > 0) return…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. public String goAgain(String str, int index) { if (index >= str.length()) return str; return str +…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 1 of 14
Get your FRQs graded in the Student Portal
In the Verityprep Student Portal, answer the FRQs of AP practice and past exams by typing or uploading a photo. A teacher grades them with that year's official College Board scoring guidelines and gives you an estimated 1–5 score.
Join Verityprep now
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.