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.

Questions 21–30 of 100
  1. 21
  2. 22
  3. 23
  4. 24
  5. 25
  6. 26
  7. 27
  8. 28
  9. 29
  10. 30

Question 21

Multiple choice Conditionals and Loops
Assume that the list of numbers nums has more than 10 elements. The program below is intended to compute and display the sum of the first 10 elements of nums.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 22

Multiple choice Algorithms
A photographer has a collection of digital pictures, each using the same file-naming format: a date tag, followed by a description, followed by the file…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 23

Multiple choice Conditionals and Loops
A programmer wants to determine whether a score is within 10 points of a given target. For example, if the target is 50, then the scores 40, 44, 50, 58, and 60…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 24

Multiple choice Variables and Assignments
Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 25

Multiple choice Conditionals and Loops
The procedure BinarySearch(numList, target) correctly implements a binary search algorithm on the list of numbers numList. The procedure returns an index where…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 26

Multiple choice Algorithms
Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. I. An algorithm that accesses each…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 27

Multiple choice Variables and Assignments
A biologist wrote a program to simulate the population of a sample of bacteria. The program uses the following procedures. Procedure Call Explanation…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 28

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 29

Multiple choice Algorithms
The following algorithm is intended to determine the average height, in centimeters, of a group of people in a room. Each person has a card, a pencil, and an…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 30

Multiple choice Variables and Assignments
An online game collects data about each player's performance in the game. A program is used to analyze the data to make predictions about how players will…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 21 of 100
Page 3 of 10