Question Bank · Unit 2
AP® Computer Science A Selection and Iteration Practice Questions
Work through AP Computer Science A practice questions on Selection and Iteration, 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.
All 740
Multiple choice 692
Free response 48
Subtopic: Iteration
Clear filter
Consider the following code segment: while ((x > y) || y >= z) { //code not shown } In the code segment above,…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment: int x = 10; int y = x / 3; int z = x % 2; x++;…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segments: I. int x = 10; int y = 20; int z = 0; if (x < y && 10 < y/z) { System.out.println("Homer"); } else {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment: int sum = 0; for (int i = 1; i <= 5; i++) { if (i % 2 ==…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. for (int j = 4; j > 0; j--) { for (/* missing code */) { System.out.print(k + " "); } System.out.println(); } This code…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. int j = 1; while (j < 4) { for (int k = 0; k <= 4; k++) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Question 127
Free response
Iteration
This question involves dog walkers who are paid through a dog-walking company to take dogs for one-hour walks. A dog-walking company has a varying number of…
Sign up now. It's free!
See the full question with its answer and worked solution.
A programmer has mistakenly placed a semicolon at the end of the while statement in the following code fragment. What will be the result of…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment: Line 1: int count = 0; Line 2: for (int i = 0; i < 3; i++) Line 3: { Line 4: int j = 0; Line 5: while (j <…
Sign up now. It's free!
See the full question with its answer and worked solution.
How many times is "Hello" printed by the following code? for (int i = 1; i…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 13 of 39
Get your FRQs graded in the Student Portal
In the Verityprep Student Portal, answer the FRQs of AP practice and past exams by typing or uploading a photo. A teacher grades them with that year's official College Board scoring guidelines and gives you an estimated 1–5 score.
Join Verityprep now
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.