- /* Boolean Practice Test
11/15/11 */
- class
BooleanPractice {
-
public static void main ( ) {
- System.out.println (
"Starting
BooleanQuestions..." ) ;
- boolean a =
true, b = false, c =
true, booleanAnswer ;
- int i =
2, j = 3, k = 4 ;
-
/////////////////////////////////////////////////////////////////////////////////////////////////
- // Write a T or F for in
the blank provided. T = true, F= false
-
-
- /* _____ 1 */
booleanAnswer = a && !b && - 2 + j < j && j > 5 - k ;
- System.out.println (
"1) " + booleanAnswer ) ;
-
-
- /* _____ 2 */
booleanAnswer = a && - j < j && j > k;
- System.out.println (
"2) " + booleanAnswer ) ;
-
-
- /* _____ 3 */
booleanAnswer = k - i / j < k || c && b || k % 2 <= j && a ;
- System.out.println ( "3) "
+ booleanAnswer ) ;
-
-
- /* _____ 4 */
booleanAnswer = !a || b || j != k && - j != (k - 1) ;
- System.out.println (
"4) " + booleanAnswer ) ;
-
-
- /* _____ 5 */
booleanAnswer = ! (!a || b || !c) && a && i >= j * i % 2 ;
- System.out.println (
"5) " + booleanAnswer ) ;
-
-
- /* _____ 6 */
booleanAnswer = ! (!(b || !a) && (a || (c && (a && (k <= j / i ) ) ) ) ) ;
- System.out.println (
"6) " + booleanAnswer ) ;
-
-
- /* _____ 7 */
booleanAnswer = ! ! ! ! ( !a && ! ( b && !c ) ) ;
- System.out.println ( "7) " + booleanAnswer ) ;
-
-
- /* _____ 8 */
booleanAnswer = ! ( k != i * 2 / j % 2 ) && b ;
- System.out.println (
"8) " + booleanAnswer ) ;
-
-
- /* _____ 9 */
booleanAnswer = b && (!( (b || a) && (a && (!c || (a || (k <= j / i ) ) ) ) ) ) ;
- System.out.println (
"9) " + booleanAnswer ) ;
-
-
- /* _____ 10 */
booleanAnswer = (b || a) && !c && (i == j % 2 + 1) && c ;
- System.out.println (
"10) " + booleanAnswer ) ;
- }
- }