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 941–950 of 3,140
  1. 941
  2. 942
  3. 943
  4. 944
  5. 945
  6. 946
  7. 947
  8. 948
  9. 949
  10. 950

Question 941

Multiple choice Unit 2: Selection and Iteration
Given that a, b, and c are integers, consider the boolean expression (a < b) || !((c…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 942

Multiple choice Unit 2: Selection and Iteration
In the following code segment, you may assume that a, b, and n are all type int. if (a != b && n / (a - b) >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 943

Multiple choice Unit 2: Selection and Iteration
Given that n and count are both of type int, which statement is true about the following code segments? I for (count = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 944

Multiple choice Unit 2: Selection and Iteration
The following fragment intends that a user will enter a list of positive integers at the keyboard and terminate the list with a sentinel. int value = 0; final…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 945

Multiple choice Unit 2: Selection and Iteration
Consider this code segment. int x = 10, y = 0; while (x > 5) { y = 3; while (y < x) { y *= 2; if (y % x == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 946

Multiple choice Unit 2: Selection and Iteration
What output will be produced by this code segment? (Ignore spacing.) for (int i = 5; i >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 947

Multiple choice Unit 2: Selection and Iteration
Consider this program segment. int newNum = 0, temp; int num = k; //k is some predefined integer value ≥ 0 while (num > 10) { temp = num % 10; num /= 10; newNum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 948

Multiple choice Unit 2: Selection and Iteration
Consider the method reverse. /** Returns n with its digits reversed. * - Example: If n = 234, method reverse returns 432. * - Precondition: n > 0. */ int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 949

Multiple choice Unit 2: Selection and Iteration
Consider the following output: 0 1 0 2 4 0 3 6 9 0 4 8 12 16 Which of the following code segments will produce this output? (A) for (int x = 1; x < 5; x++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 950

Multiple choice Unit 2: Selection and Iteration
The speed limit of a stretch of highway is 55 miles per hour (mph). The highway patrol issues speeding tickets to anyone caught going faster than 55 miles per…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 941 of 3,140
Page 95 of 314