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.

Subtopic: Iteration Clear filter

Questions 41–50 of 383
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Iteration
How many times does the following loop iterate? // x has been…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice Iteration
How many times does the following loop iterate? // x has been initialized with a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Iteration
How many times does the following loop execute? // x has been initialized with a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Iteration
What will the call to the method funWithNumbers(314159) print to the screen? public void funWithNumbers(double myDouble) { int myInt =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Iteration
Consider the following code segment: int x = 10; int y = 2; int count = 1; while(x > y)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Iteration
Consider the following code segment: int p = 5; while(p > 0) { for(int j = p; j < p*2; j++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Multiple choice Iteration
Consider the following code segment: int counter = 5; int sum = 0; while(counter < 10) { sum+= counter; counter+=2; } Which of the following for loops would…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Multiple choice Iteration
How many times will the word "Heyo!" be printed in the following code segment? int count =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Multiple choice Iteration
Consider the following code segment: int num = 8; for(int i = num; i > 0; i -= 3) //Line 2 {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Multiple choice Iteration
Consider the following code segment: for(int j = 0; j < 4; j++) //Line 1 { for(int k = 0; k < j+1; k++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 383
Page 5 of 39