AP® Computer Science A Multiple Choice Questions
Work through AP Computer Science A multiple-choice 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.
Question 1002
Question 1003
Question 1004
Question 1005
Question 1006
Question 1007
Question 1008
Question 1009
int x = 4, y = 10, z = 4;
boolean a = !(x > y) && !(z == x);
boolean b = (x < y) || (z > x);
boolean c = !(x == z || y < x);
System.out.println(a + " " + b + " " + c);Main Solution
Solution:
Correct: A. a = !(4>10) && !(4==4) = true && false = false. b = (4<10) || (4>4) = true || false = true. c = !(4==4 || 10<4) = !(true || false) = false. Output: false true false.
Answer: Correct: A
Answer images
Question 1010
int n = 100;
int count = 0;
while (n > 1)
{
n = n / 2;
count++;
}
System.out.println(count);Main Solution
Solution:
Correct: B. Trace of n: 100 → 50 → 25 → 12 → 6 → 3 → 1. The loop runs 6 times (the condition n>1 becomes false when n = 1).
Answer: Correct: B
Answer images
AP® and Advanced Placement® are registered trademarks of the College Board, which is not affiliated with, and does not endorse, Verityprep. Names are used for identification purposes only.

