Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice 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,291–2,300 of 3,140
  1. 2291
  2. 2292
  3. 2293
  4. 2294
  5. 2295
  6. 2296
  7. 2297
  8. 2298
  9. 2299
  10. 2300

Question 2291

Multiple choice Unit 4: Data Collections
Refer to method mystery. public int mystery(int n, int a, int d) { if (n == 1) return a;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2292

Multiple choice Unit 4: Data Collections
Refer to method f. public int f(int k, int n) { if (n == k) return k; else if (n > k)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2293

Multiple choice Unit 4: Data Collections
What does method recur do? / * x is an array of n integers. * n is a positive integer. * / public int recur(int[] x,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2294

Multiple choice Unit 4: Data Collections
Which best describes what the printString method below does? public void printString(String s)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2295

Multiple choice Unit 4: Data Collections
Refer to the method power. / * * Returns base raised to the expo power. * Precondition: * - base is a nonzero real number. * - expo is an integer. * / public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2296

Multiple choice Unit 4: Data Collections
Consider the following method. public void doSomething(int n) { if (n > 0) { doSomething(n - 1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2297

Multiple choice Unit 4: Data Collections
A user enters several positive integers at the keyboard and terminates the list with a sentinel (-999). A writeEven method reads those integers and outputs the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2298

Multiple choice Unit 4: Data Collections
What is returned by mystery(3)?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2299

Multiple choice Unit 4: Data Collections
What does t(5) return? // Precondition: n is positive. public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2300

Multiple choice Unit 4: Data Collections
How many calls to t occur for t(6), including the initial call? // Precondition: n is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,291 of 3,140
Page 230 of 314