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 791–800 of 3,140
  1. 791
  2. 792
  3. 793
  4. 794
  5. 795
  6. 796
  7. 797
  8. 798
  9. 799
  10. 800

Question 791

Multiple choice Unit 2: Selection and Iteration
int k = a random number such that 1 ≤ k ≤ n ; for (int p = 2; p <= k; p++) for (int r = 1; r < k;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 792

Multiple choice Unit 2: Selection and Iteration
Assume that x and y are boolean variables and have been properly initialized. (x &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 793

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int k = 0; while (k < 10) { System.out.print((k % 3) + " ");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 794

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int x = /* some integer value */ ; int y = /* some integer value */ ; boolean result = (x < y); result = ( (x >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 795

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. for (int outer = 0; outer < n; outer++) { for (int inner = 0; inner <= outer; inner++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 796

Multiple choice Unit 2: Selection and Iteration
Assume that a and b are variables of type int. The expression !(a < b) && !(a > b)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 797

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int a = 24; int b = 30; while (b != 0) { int r = a % b; a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 798

Multiple choice Unit 2: Selection and Iteration
Consider the following code segments. Which of the code segments above will produce the following output? I. int k = 1; while (k < 20) { if (k % 3 == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 799

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. double a = 1.1; double b = 1.2; if ((a + b) * (a - b) != (a * a) - (b * b)) { System.out.println("Mathematical error!");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 800

Multiple choice Unit 2: Selection and Iteration
Which of the following code segments is equivalent to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 791 of 3,140
Page 80 of 314