Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, 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 2,541–2,550 of 2,811
  1. 2541
  2. 2542
  3. 2543
  4. 2544
  5. 2545
  6. 2546
  7. 2547
  8. 2548
  9. 2549
  10. 2550

Question 2541

Multiple choice Unit 4: Data Collections
data.txt contains one line: Hello-World-AP-CSA. The file opens successfully and checked exceptions are handled by the enclosing method. What is printed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2542

Multiple choice Unit 4: Data Collections
Consider the following method. public static void readFile(String filename) { File file = new File(filename); Scanner sc = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2543

Multiple choice Unit 4: Data Collections
Assume that an ArrayList names holds the following values. {"Debbie", "Rob", "Kelly", "Sandy", "Kim", "J.P. ", "Andy", "Tim",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2544

Multiple choice Unit 4: Data Collections
Suppose that glop is an ArrayList of DooHickeys. The Doohickeys class contains two accessor methods getMass() and getId() that returns the mass and ID number…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2545

Multiple choice Unit 4: Data Collections
private int n; public boolean check(int[ ] arr) { boolean theCheck = true; for (int k = 0; k < n - 1; k++) { if (arr[k] >= arr[k+1]) theCheck =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2546

Multiple choice Unit 4: Data Collections
private int n; public boolean check(int[ ] arr) { boolean theCheck = true; for (int k = 0; k < n - 1; k++) { if (arr[k] >= arr[k+1]) theCheck =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2547

Multiple choice Unit 4: Data Collections
Consider the following incomplete method that is intended to determine if the corresponding elements of two parallel arrays are equal. // precondition:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2548

Multiple choice Unit 4: Data Collections
Consider the following code segment: String[] data = {"3.5", "2.1", "4.4", "1.2"}; double sum = 0.0; for (int i = 0; i < data.length; i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2549

Multiple choice Unit 4: Data Collections
Consider the following recursive method. public static int mystery(int x) { if (x <= 1 || x == 3)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2550

Multiple choice Unit 4: Data Collections
Consider the following code segment: public void readLines() { File myFile = new File("data.txt"); Scanner scanner = new Scanner(myFile); while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,541 of 2,811
Page 255 of 282