Verityprep
Question Bank · Unit 4

AP® Computer Science Principles Algorithms and Programming Practice Questions

Work through AP Computer Science Principles practice questions on Algorithms and Programming, 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: Conditionals and Loops Clear filter

Questions 11–20 of 24
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Conditionals and Loops
Assume that the list originalList contains integer values and that the list newList is initially empty. The following code segment is intended to copy all even…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Conditionals and Loops
The following procedure is intended to return true if at least two of the three parameters are equal in value and is intended to return false otherwise.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Conditionals and Loops
Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Conditionals and Loops
Which is a benefit of iterative…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Conditionals and Loops
A spinner has Red, Blue and Yellow sectors. Red is four times the size of each of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Conditionals and Loops
The robot starts facing right. Which code moves it to the shaded goal? PROCEDURE…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Conditionals and Loops
The robot initially faces up and may enter white or shaded cells but not black cells. GoalReached() is true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Conditionals and Loops
The guessing-game loop never terminates. Where should win ← true be inserted to make it work as intended? 1: secretNumber ← RANDOM(1,100) 2: win ← false 3:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice Conditionals and Loops
An apartment rental site uses this flowchart to assign include. Which statement is equivalent? Symbol…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Conditionals and Loops
A researcher simulates mice in an environment with predators. Which assumption is made by this program? days ← 0 numMice ← InitialMousePopulation() numPredators…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 24
Page 2 of 3