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 31–40 of 48
  1. 31
  2. 32
  3. 33
  4. 34
  5. 35
  6. 36
  7. 37
  8. 38
  9. 39
  10. 40

Question 31

Free response Boolean Expressions
Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 32

Free response Boolean Expressions
Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not count towards the sum and values to its right do not count. So…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 33

Free response Boolean Expressions
Given 3 int values, a b c, return their sum. However, if any of the values is a teen -- in the range 13..19 inclusive -- then that value counts as 0, except 15…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 34

Free response Boolean Expressions
For this problem, we'll round an int value up to the next multiple of 10 if its rightmost digit is 5 or more, so 15 rounds up to 20. Alternately, round down to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 35

Free response Boolean Expressions
Given three ints, a b c, return true if one of b or c is "close" (differing from a by at most 1), while the other is "far", differing from both other values by…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 36

Free response Boolean Expressions
Given 2 int values greater than 0, return whichever value is nearest to 21 without going over. Return 0 if they both go over.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 37

Free response Boolean Expressions
Given three ints, a b c, one of them is small, one is medium and one is large. Return true if the three values are evenly spaced, so the difference between…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 38

Free response Boolean Expressions
We want make a package of goal kilos of chocolate. We have small bars (1 kilo each) and big bars (5 kilos each). Return the number of small bars to use,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 39

Free response Iteration
This question involves dog walkers who are paid through a dog-walking company to take dogs for one-hour walks. A dog-walking company has a varying number of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 40

Free response Iteration
A teacher wants to analyze student-submitted text. You will write methods for a TextAnalyzer class. The class has a single instance variable: private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 31 of 48
Page 4 of 5