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 1,011–1,020 of 3,140
  1. 1011
  2. 1012
  3. 1013
  4. 1014
  5. 1015
  6. 1016
  7. 1017
  8. 1018
  9. 1019
  10. 1020

Question 1011

Multiple choice Unit 2: Selection and Iteration
Consider the following method: private double compute(int x, int y) { double r = 0; if (!(y == 0 || x / y <= 2)) { r = 1 /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1012

Multiple choice Unit 2: Selection and Iteration
Consider the following method: /* * Returns the number of times the digit d occurs in the decimal representation of * Precondition: n and d are non-negative…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1013

Multiple choice Unit 2: Selection and Iteration
When is the following Boolean expression…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1014

Multiple choice Unit 2: Selection and Iteration
Which of the following code segments will produce the following output? 1 22 333 4444 Code Segments: I. for (int i = 1; i < 5; i++) { for (int j = i; j > 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1015

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment: int i = a random number such that 1 <= i <= n; for (int a = 2; a <= i; a++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1016

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment: for (int i = 0; i <= 3; i++) { for (int j = i;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1017

Multiple choice Unit 2: Selection and Iteration
What are the values of a and b after the for loop finishes? int a = 10; int b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1018

Multiple choice Unit 2: Selection and Iteration
Consider the following method: public static void sample(int num1, int num2) { int result = 99; if (num1 == num2) { result = 0; } else if (num1 > num2) { result…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1019

Multiple choice Unit 2: Selection and Iteration
Given the following code segment: for (int j = 1; j <= 5; j++) { for (int k = 1; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1020

Multiple choice Unit 2: Selection and Iteration
Consider the following method: public void sample(int num1, int num2) { int result = 99; if (num1 == num2) { result = 0; } else if (num1 > num2) { result = 1; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1,011 of 3,140
Page 102 of 314