Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Practice Questions

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

Subtopic: Boolean Expressions Clear filter

Questions 71–80 of 357
  1. 71
  2. 72
  3. 73
  4. 74
  5. 75
  6. 76
  7. 77
  8. 78
  9. 79
  10. 80

Question 71

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 72

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 73

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 74

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 75

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 76

Free response Boolean Expressions
Given three ints, a b c, return true if two or more of them have the same rightmost digit. The ints are non-negative. Note: the % "mod" operator computes the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 77

Free response Boolean Expressions
Given three ints, a b c, return true if one of them is 10 or more less than one of the others. lessBy10(1, 7, 11) → true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 78

Free response Boolean Expressions
Return the sum of two 6-sided dice rolls, each in the range 1..6. However, if noDoubles is true, if the two dice show the same value, increment one die to the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 79

Free response Boolean Expressions
Given two int values, return whichever value is larger. However if the two values have the same remainder when divided by 5, then the return the smaller value.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 80

Free response Boolean Expressions
You have a red lottery ticket showing ints a, b, and c, each of which is 0, 1, or 2. If they are all the value 2, the result is 10. Otherwise if they are all…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 71 of 357
Page 8 of 36