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
Which of the following code segments will print exactly eight "$" symbols? I. for (int i = 0; i < 8; i++) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. int a = /* value supplied within program */ int b = /* value supplied within program */ if (/* missing condition */) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. int n = 0 ; while ( n < 20) { System.out.print(n % 4 + " " ) ; if (…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following method. public int someMethod(int val) { for (int i = 2; i < 7; i++) { if…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. for (int h = 2; h <= 6; h += 2) { for (int k = 30; k > 0; k -= 10) { System.out.print(h + k + " "); } } Consider these…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. for (int h = 5; h >= 0; h = h - 2) { for (int k = 0; k < 3; k++) { if ((h…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. int number = Integer.MAX_VALUE; while (number > 0) { number = number / 2; } for…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. int value = 33; boolean calculate = true; while (value > 5 || calculate) {…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following code segment. for (int k = 0; k < 20; k = k + 2) { if (k % 3 ==…
Sign up now. It's free!
See the full question with its answer and worked solution.
Consider the following output. 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5…
Sign up now. It's free!
See the full question with its answer and worked solution.
Page 8 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.