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 331–340 of 1,222
  1. 331
  2. 332
  3. 333
  4. 334
  5. 335
  6. 336
  7. 337
  8. 338
  9. 339
  10. 340

Question 331

Multiple choice Arrays
Which initializes an int array with four zero elements? I: int[] arr={0,0,0,0};…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 332

Multiple choice Arrays
Assume location has been declared. The segment should locate the first negative…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 333

Multiple choice Arrays
What occurs for a nonempty int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 334

Multiple choice Arrays
arr1 initially contains [0,6,0,4,0,0,2]. What does…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 335

Multiple choice Arrays
Assume k≥2 and arr.length>k. What is the maximum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 336

Multiple choice Arrays
What will be output from the following code segment, assuming it is in the same class as the doSomething method? int[] arr = {1, 2, 3, 4}; doSomething(arr);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 337

Multiple choice Arraylists
A program reads an unknown number of text-file…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 338

Multiple choice Arraylists
For intensive calculations over a fixed-size list of numeric values,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 339

Multiple choice Arrays
Assume every list element is a nonnull Address. Which statement in the enhanced loop prints each name? public class Address { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 340

Multiple choice Arrays
Every element of Address[] list is nonnull. Address has no overridden toString. Which replacement prints each full mailing address using the accessors? I uses…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 331 of 1,222
Page 34 of 123