Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration FRQ

Work through AP Computer Science A free-response 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.

Questions 1–10 of 48
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Free response Boolean Expressions
You and your date are trying to get a table at a restaurant. The parameter "you" is the stylishness of your clothes, in the range 0..10, and "date" is the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Free response Boolean Expressions
The squirrels in Palo Alto spend most of the day playing. In particular, they play if the temperature is between 60 and 90 (inclusive). Unless it is summer,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Free response Boolean Expressions
You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int value: 0=no ticket, 1=small ticket, 2=big…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Free response Boolean Expressions
Given 2 ints, a and b, return their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just return 20.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Free response Boolean Expressions
Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00" indicating…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Free response Boolean Expressions
The number 6 is a truly great number. Given two int values, a and b, return true if either one is 6. Or if their sum or difference is 6. Note: the function…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Free response Boolean Expressions
Given a number n, return true if n is in the range 1..10, inclusive. Unless outsideMode is true, in which case return true if the number is less or equal to 1,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Free response Boolean Expressions
We'll say a number is special if it is a multiple of 11 or if it is one more than a multiple of 11. Return true if the given non-negative number is special. Use…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Free response Boolean Expressions
Return true if the given non-negative number is 1 or 2 more than a multiple of 20. See also: Introduction to Mod…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Free response Boolean Expressions
Return true if the given non-negative number is a multiple of 3 or 5, but not both. Use the % "mod" operator -- see…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 48
Page 1 of 5