Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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.

Questions 201–210 of 692
  1. 201
  2. 202
  3. 203
  4. 204
  5. 205
  6. 206
  7. 207
  8. 208
  9. 209
  10. 210

Question 201

Multiple choice Iteration
Consider the following code segment: int i = a random number such that 1 <= i <= n; for (int a = 2; a <= i; a++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 202

Multiple choice Iteration
Consider the following code segment: for (int i = 0; i <= 3; i++) { for (int j = i;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 203

Multiple choice Iteration
What are the values of a and b after the for loop finishes? int a = 10; int b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 204

Multiple choice Boolean Expressions
Consider the following method: public static void sample(int num1, int num2) { int result = 99; if (num1 == num2) { result = 0; } else if (num1 > num2) { result…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 205

Multiple choice Iteration
Given the following code segment: for (int j = 1; j <= 5; j++) { for (int k = 1; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 206

Multiple choice Boolean Expressions
Consider the following method: public void sample(int num1, int num2) { int result = 99; if (num1 == num2) { result = 0; } else if (num1 > num2) { result = 1; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 207

Multiple choice Iteration
Given the following code segment: int t = 13; while (t < 29) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 208

Multiple choice Iteration
Given the following code segment: int a = 5, b = 2, temp; for (int i = 1; i <= 4; i++) { temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 209

Multiple choice Iteration
Consider the following code segment: for(int i = 0; i < 3; i++) { for(int j = 1; j <= 7;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 210

Multiple choice Boolean Expressions
Consider the following Java method, conditionTest, which takes two integer arguments, num1 and num2, and prints a letter based on their values: public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 201 of 692
Page 21 of 70