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 301–310 of 3,140
  1. 301
  2. 302
  3. 303
  4. 304
  5. 305
  6. 306
  7. 307
  8. 308
  9. 309
  10. 310

Question 301

Multiple choice Unit 1: Using Objects and Methods
Which of these expressions correctly computes the positive root of a quadratic equation assuming coefficients a, b, c have…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 302

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = /* value supplied within program */; int b = /* value supplied within program */; if ( /* missing condition */…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 303

Multiple choice Unit 1: Using Objects and Methods
The following shuffling method is used to shuffle an array arr of int values. The method assumes the existence of a swap method, where swap(arr,i,j)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 304

Multiple choice Unit 1: Using Objects and Methods
An algorithm for finding the average of N numbers is \[\text{average} = \frac{\text{sum}}{N}\] where N and sum are both integers. In a program…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 305

Multiple choice Unit 1: Using Objects and Methods
Consider method getCount below. public static int getCount(String s, String sub) { int count = 0; int pos = s.indexOf(sub); while (pos >= 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 306

Multiple choice Unit 1: Using Objects and Methods
This question is based on the following declarations. String strA = "CARROT", strB = "Carrot", strC = "car";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 307

Multiple choice Unit 1: Using Objects and Methods
A programmer has a file of names. She is designing a program that sends junk mail letters to everyone on the list. To make the letters sound personal and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 308

Multiple choice Unit 1: Using Objects and Methods
Refer to the nextIntInRange method below. /** Returns a random integer in the range low to high, inclusive. */ public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 309

Free response Unit 1: Using Objects and Methods
This question uses a password checker to report whether a given password is weak, medium, or strong. The PasswordChecker class is shown below. You will write…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 310

Multiple choice Unit 1: Using Objects and Methods
What output is produced by the following line of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 301 of 3,140
Page 31 of 314