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 141–150 of 341
  1. 141
  2. 142
  3. 143
  4. 144
  5. 145
  6. 146
  7. 147
  8. 148
  9. 149
  10. 150

Question 141

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 142

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 143

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 144

Multiple choice Arrays
All Student entries and their Address fields are nonnull. Which statement in the loop prints each student’s name? public class Address { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 145

Multiple choice Arrays
For a nonempty Student array of nonnull entries, which locate bodies always return a student with maximum idNum? public class Address { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 146

Multiple choice Arrays
Which replaces /* more code */ in the constructor to initialize tickList? public class Ticket { private String row private int seat private double price public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 147

Multiple choice Arrays
Which replaces /* code to calculate amount */ in totalPaid, after all ticket entries are initialized? public class Ticket { private String row private int seat…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 148

Multiple choice Arrays
There are NUMSALES transactions. Which declares an array suitable for storing them? public class Ticket { private String row private int seat private double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 149

Multiple choice Arrays
For a nonempty arr with n=arr.length, which modification makes the minimum-finding segment correct? I: change i=1 to i=0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 150

Multiple choice Arrays
bookList contains distinct nonnull Book objects. What does the enhanced-for loop do? public class Book { private String title,author private boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 141 of 341
Page 15 of 35