Verityprep
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.

Questions 201–210 of 740
  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 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.

Question 202

Multiple choice Boolean Expressions
Consider the following code segment. int num1 = 9; int num2 = 5; if (num1 > num2) { System.out.print((num1 + num2) %…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 203

Multiple choice Boolean Expressions
Consider the following code segment. int value = initValue; if (value > 10) if (value > 15) value = 0; else value =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 204

Multiple choice Boolean Expressions
Assume that a, b, and c have been declared and initialized with int values. The expression !(a > b || b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 205

Multiple choice Boolean Expressions
A high school class places students in a course based on their average from a previous course. Students that have an average 92 or above are placed in an honors…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 206

Multiple choice Boolean Expressions
Assume that x, y, and z have been declared as follows: boolean x = true; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 207

Multiple choice Boolean Expressions
Consider the following code segment. int amount = initValue; if (amount…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 208

Multiple choice Boolean Expressions
Which segment of code will correctly print the two Strings name1 and name2 in alphabetical order? if (name1 < name2) System.out.println(name1 + " " + name2); I.…

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 j = 0; j < 10; j++) { for (int k = 10; k > j; k--) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 210

Multiple choice Iteration
Consider the following code segment. boolean b1 = true; boolean b2 = true; int x = 7; while (b1 || b2) { if (x > 4) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 201 of 740
Page 21 of 74