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.

Subtopic: Arrays Clear filter

Questions 41–50 of 341
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Arrays
Consider the following method with two missing statements. /** Returns the sum of all positive odd values * among the first n elements of arr. * Precondition: 1…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice Arrays
Consider the following method. public void reduce(int[] arr, int len) { for (int k = 0; k < len; k++) { arr[k]--; } len--; } What is printed when the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Arrays
Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Arrays
Which of the following are valid arrays? I. int[] coolArray = {1, 2, 3}; II.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Arrays
What is the output of the following program? public class SayHello { public void run() { String stringArray[] =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Arrays
You are working at the frozen yogurt shop in the mall. Your boss asks you to count how many flavors have the word chocolate in their name. You begin going…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Multiple choice Arrays
What value does mysteryNumber hold afterward? int mysteryNumber = 0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Multiple choice Arrays
What does gameBoard contain afterward? int WIDTH=3, HEIGHT=3…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Multiple choice Arrays
What is arr [4] afterward? int[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Multiple choice Arrays
The nonempty int array may contain any int values. Which initializers always make findMin correct? I: Integer.MAX_VALUE.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 341
Page 5 of 35