Booleans

Here are some additional examples of computing with Boolean values. They are not homework to be turned in (indeed, I've provided my solutions for you to look at after you've written your own), but examples for you to try if you're having trouble with the section.

  1. Evaluate the expression (and (> x 0) (> y 0)) by hand for each of the following cases:
    1. x=2 and y=5
    2. x=0 and y=5
    3. x=5 and y=0
  2. Evaluate the expression (not (and (> x 0) (> y 0))) by hand for each of the following cases:
    1. x=2 and y=5
    2. x=0 and y=5
    3. x=5 and y=0
  3. Evaluate the expression (not (or (not (= x 0)) (not (= y 0))) for each of the following cases:
    1. x=2 and y=5
    2. x=0 and y=5
    3. x=5 and y=0
  4. Write a function that produces true if the parameter is between -15 and +7 inclusive, and otherwise false.
  5. Write a function with three parameters -- A, B, and C -- that produces true if, and only if, the square of A is smaller than the product of B and C.
  6. Write a function that produces true if its parameter either between -8 and +8, or larger than 33.
  7. Write a function of R and S that produces true if the area of a disk with radius R is larger than the area of a square whose sides are length S.

Last modified: Mon Sep 20 16:32:16 EDT 1999
Stephen Bloch / sbloch@adelphi.edu