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 121–130 of 692
  1. 121
  2. 122
  3. 123
  4. 124
  5. 125
  6. 126
  7. 127
  8. 128
  9. 129
  10. 130

Question 121

Multiple choice Iteration
Consider the following code segment. for (int j = 0;j < 4;j++) { for ( / * missing code * / ) { System.out.print("(" + j + "," + k + ") "); }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 122

Multiple choice Boolean Expressions
Consider the following code segment. if (n != 0 && x / n > 100) statement1; else…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 123

Multiple choice Boolean Expressions
What will the output be for the following poorly formatted program segment, if the input value for num is 22? int num = call to a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 124

Multiple choice Boolean Expressions
What values are stored in x and y after execution of the following program segment? int x = 30, y =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 125

Multiple choice Boolean Expressions
Which of the following will evaluate to true only…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 126

Multiple choice Boolean Expressions
Assume that a and b are integers. The boolean expression !(a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 127

Multiple choice Boolean Expressions
Given that a, b, and c are integers, consider the boolean expression (a < b) || !((c…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 128

Multiple choice Boolean Expressions
In the following code segment, you may assume that a, b, and n are all type int. if (a != b && n / (a - b) >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 129

Multiple choice Iteration
Given that n and count are both of type int, which statement is true about the following code segments? I for (count = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 130

Multiple choice Iteration
The following fragment intends that a user will enter a list of positive integers at the keyboard and terminate the list with a sentinel. int value = 0; final…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 121 of 692
Page 13 of 70