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 11–20 of 48
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Free response Boolean Expressions
Return true if the given non-negative number is 1 or 2 less than a multiple of 20. So for example 38 and 39 return true, but 40 returns false. See…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Free response Boolean Expressions
Given a non-negative number num, return true if num is within 2 of a multiple of 10. Note: (a % b) is the remainder of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Free response Boolean Expressions
Given 2 ints, a and b, return their sum. However, "teen" values in the range 13..19 inclusive, are extra lucky. So if either value is a teen,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Free response Boolean Expressions
Your cell phone rings. Return true if you should answer it. Normally you answer, except in the morning you only answer if it is your mom calling. In all cases,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Free response Boolean Expressions
We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as 0=bad, 1=good, or 2=great. A party is good (1) if both tea…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Free response Boolean Expressions
Given a string str, if the string starts with "f" return "Fizz". If the string ends with "b" return "Buzz". If both the "f" and "b" conditions are true, return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Free response Boolean Expressions
Given an int n, return the string form of the number followed by "!". So the int 6 yields "6!". Except if the number is divisible by 3 use "Fizz" instead of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Free response Boolean Expressions
Given three ints, a b c, return true if it is possible to add two of the ints to get the third. twoAsOne(1, 2, 3) → true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Free response Boolean Expressions
Given three ints, a b c, return true if b is greater than a, and c is greater than b. However, with the exception that if "bOk" is true, b does not need to be…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Free response Boolean Expressions
Given three ints, a b c, return true if they are in strict increasing order, such as 2 5 11, or 5 6 7, but not 6 5 7 or 5 5 7. However, with the exception that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 48
Page 2 of 5