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 51–60 of 341
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Multiple choice Arrays
What is arr after mystery()? private int[]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Multiple choice Arrays
For a nonempty int array arr, arr[0]!=arr[i] for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Multiple choice Arrays
Which loop throws ArrayIndexOutOfBoundsException…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Multiple choice Arrays
Which code actually adds 5 to every array element? I int[] numbers={1,2,3,4}; for(int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Multiple choice Arrays
The method should return true if target appears anywhere in arr. Which statement is true? public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

Multiple choice Arrays
What happens when the code is compiled and run? int[] highTemp={88,92,94,90,88,83} int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 57

Multiple choice Arrays
For a nonempty array, does shiftRight rotate every element one position right, wrapping the last to the first? public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 58

Multiple choice Arrays
For nums={4,4,7,7}, the method from 2558 is repaired by starting i=0 and looping while i<nums.length−1. How many equality tests occur before it returns? public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 59

Multiple choice Arrays
Which loop does NOT print every…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 60

Multiple choice Arrays
Which initializes a boolean array of three elements all containing true? I: boolean[] arr={true, true,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 51 of 341
Page 6 of 35