Verityprep
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.

Questions 971–980 of 1,222
  1. 971
  2. 972
  3. 973
  4. 974
  5. 975
  6. 976
  7. 977
  8. 978
  9. 979
  10. 980

Question 971

Multiple choice Arrays
public static int countNull(String[] arr) { int count = 0; for (int i = 0;i < arr.length;i++) { if (arr[i] == null) { count++; } } return count; } String[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 972

Multiple choice Arrays
Consider the following method: public static int countWordNull(String[] arr) { int count = 0; for (int i = 0; i < arr.length; i++) { if (arr[i].equals("null"))…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 973

Multiple choice Arrays
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 974

Multiple choice 2D Arrays
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 975

Multiple choice Recursion
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 976

Multiple choice Recursion
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 977

Multiple choice Recursion
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 978

Multiple choice Recursion
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 979

Multiple choice Recursion
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 980

Multiple choice Recursion
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 971 of 1,222
Page 98 of 123