Quiz 1 (Prelim) Flashcards
int num1 = 3, num2 = 2;
(num1 < num2)
(True or False)
F
double hours = 92.8;
(hours > 40.2)
(True or False)
T
char letter = ‘A’;
(‘A’ < letter)
(True or False)
F
int age = 1;
(age != 1)
(True or False)
F
double y = -2.3;
y >= 0.0;
(True or False)
F
x = false, y = false, z = false
!(x && y) || z
(True or False)
T
x = false, y = false, z = false
x || (z && (!y || x))
(True or False)
F
x = false, y = false, z = false
true || !z && y
(True or False)
T
x = false, y = false, z = false
z && x || y
(True or False)
F
x = false, y = false, z = false
false || !x && y
(True or False)
F
If either or both expressions evaluate to False, the _______ operator returns False.
AND
If either or both expressions evaluate to True, the _______ operator returns True.
OR
int x = 8;
if (x > 10)
…..System.out.println(“x is within the range. \n”);
System.out.println(“Section allows decision making. \n”);
Output:
Section allows decision making.
int x = 8;
if (x < 8)
{
…..System.out.println(“x is within the range. \n”);
…..System.out.println(“This is a true statement. \n”);
}
System.out.println(“And, after selection, the next statement is exeuted. \n”)
Output:
And, after selection, the next statement is exeuted.
int x = 8;
boolean found = true;
if (x == 6 || found)
…..System.out.println(“The equation is true. \n”);
System.out.println(“End of expression. \n”);
Output:
The equation is true.