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: Algorithms Clear filter

Questions 31–40 of 49
  1. 31
  2. 32
  3. 33
  4. 34
  5. 35
  6. 36
  7. 37
  8. 38
  9. 39
  10. 40

Question 31

Multiple choice Algorithms
len(str) returns the string length. What is displayed? nameList ←…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 32

Multiple choice Algorithms
The robot starts in the bottom row facing up. It can enter white or…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 33

Multiple choice Algorithms
vals has 100 elements. The code displays whether vals is sorted from least to greatest. How should it change to detect greatest-to-least ordering? 1:…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 34

Multiple choice Algorithms
countBottles(r) returns the number collected by room r; nonempty roomList contains school room numbers. The code should store the identifier of a room with the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 35

Multiple choice Algorithms
characterList stores single-character strings. Uppercase letters occupy indices 65 through 90. concat(string1,string2) joins two strings; for example…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 36

Multiple choice Algorithms
list1 and list2 are nonempty lists sorted least to greatest. Both algorithms intend to combine all their elements into a sorted newList. Which statement is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 37

Multiple choice Algorithms
The program should put originalList in random order into initially empty resultList, leaving originalList empty. Which replacement works?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 38

Multiple choice Algorithms
wordList is a nonempty list of strings. What happens when targetWord does not occur in it? PROCEDURE…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 39

Multiple choice Algorithms
Which task is most likely…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 40

Multiple choice Algorithms
Two identical processors run independent jobs. Each processor can run one job at a time, and a job cannot be split…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 31 of 49
Page 4 of 5