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,891–2,900 of 3,140
  1. 2891
  2. 2892
  3. 2893
  4. 2894
  5. 2895
  6. 2896
  7. 2897
  8. 2898
  9. 2899
  10. 2900

Question 2891

Multiple choice Unit 4: Data Collections
public static int countSpecial(String[] arr) { int count = 0; for (int i = 0;i < arr.length;i++) { if (arr[i] == null || arr[i].equals("")) { count++; } }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2892

Multiple choice Unit 4: Data Collections
public static int countWordNull(String[][] arr) { int count = 0; for (int r = 0;r < arr.length;r++) { for (int c = 0;c < arr[r].length;c++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2893

Multiple choice Unit 4: Data Collections
public static int calculateValue(int n) { if (n <= 1) { return 1; } return n *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2894

Multiple choice Unit 4: Data Collections
public static int processValue(int n) { if (n == 0) { return 0; } return n +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2895

Multiple choice Unit 4: Data Collections
public static int evaluateNumber(int n) { if (n == 0) { return 1; } return 1 +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2896

Multiple choice Unit 4: Data Collections
public static int transformNumber(int n) { if (n == 0) { return 0; } if (n % 2 == 0) { return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2897

Multiple choice Unit 4: Data Collections
public static int analyzeValue(int n) { if (n == 1) { return 1; } return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2898

Multiple choice Unit 4: Data Collections
public static int recursiveProcess(int n) { if (n == 0) { return 0; } return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2899

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: 5 7 3 public static int readNumbers() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2900

Multiple choice Unit 4: Data Collections
Assume the file data.txt contains: apple banana cat public static int countLines() throws Exception { Scanner file = new Scanner(new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,891 of 3,140
Page 290 of 314