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 61–70 of 357
  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70

Question 61

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 62

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 63

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 64

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 65

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 66

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 67

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 68

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 69

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 70

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 61 of 357
Page 7 of 36