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: Variables and Assignments Clear filter

Questions 11–17 of 17
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17

Question 11

Multiple choice Variables and Assignments
The code is intended to swap first and second using temp. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Variables and Assignments
Which of the following would be…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Variables and Assignments
A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Variables and Assignments
An experiment has 75% expected successful trials and 25% unsuccessful trials. Which condition completes the simulation? successful ← 0 unsuccessful ← 0 REPEAT…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Variables and Assignments
A word-game algorithm returns the first letter of every palindrome word, in alphabetical order. For ["banana","kayak","mom","apple","level"], it returns…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Variables and Assignments
Which best describes this program? count ← 1 sum ← 0 REPEAT…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Variables and Assignments
Concat(str1,str2) joins the two strings. Substring(str,start,length) takes length characters from…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 17
Page 2 of 2