Quiz 1 (Prelim) Flashcards

1
Q

int num1 = 3, num2 = 2;
(num1 < num2)

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

double hours = 92.8;
(hours > 40.2)

(True or False)

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

char letter = ‘A’;
(‘A’ < letter)

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

int age = 1;
(age != 1)

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

double y = -2.3;
y >= 0.0;

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

x = false, y = false, z = false
!(x && y) || z

(True or False)

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

x = false, y = false, z = false
x || (z && (!y || x))

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

x = false, y = false, z = false
true || !z && y

(True or False)

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

x = false, y = false, z = false
z && x || y

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

x = false, y = false, z = false
false || !x && y

(True or False)

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If either or both expressions evaluate to False, the _______ operator returns False.

A

AND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If either or both expressions evaluate to True, the _______ operator returns True.

A

OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

int x = 8;
if (x > 10)
…..System.out.println(“x is within the range. \n”);
System.out.println(“Section allows decision making. \n”);

Output:

A

Section allows decision making.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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:

A

And, after selection, the next statement is exeuted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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:

A

The equation is true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

int x = 8;
if (x >= 5)
{
}
else
…..System.out.println(“Have a good day. \n”);
System.out.println(“The value of x is” + x + “\n”);

Output:

A

The value of x is 8

17
Q

int x = 8;
boolean found = true;
if (x != 6 && ! found)
…..System.out.println(“The expression is true. \n”);
else
…..System.out.println(“The expression is false. \n”);
System.out.println(“End of expression. \n”);

Output:

A

The expression is false.
End of expression.

18
Q

int x = 8;

if (x > 0 && x > 10)
…..System.out.println(“x is in range. \n”);
else
…..System.out.println(“x is out of range. \n”);

Output:

A

x is out of range.

19
Q

if (temp >= 70 && month >= 6)
…..System.out.println(“Wear sandals \n”);
else if (name == “Pat”)
…..System.out.println(“Wear white shoes\n”);
else
…..System.out.println(“Wear black shoes\n”);

int temp= 78; int month = 6; String name = “Pat”;

Output:

A

Wear sandals

20
Q

if (temp >= 70 && month >= 6)
…..System.out.println(“Wear sandals \n”);
else if (name == “Pat”)
…..System.out.println(“Wear white shoes\n”);
else
…..System.out.println(“Wear black shoes\n”);

int temp= 70; int month = 5; String name = “Pat”;

Output:

A

Wear white shoes

21
Q

if (temp >= 70 && month >= 6)
…..System.out.println(“Wear sandals \n”);
else if (name == “Pat”)
…..System.out.println(“Wear white shoes\n”);
else
…..System.out.println(“Wear black shoes\n”);

int temp= 60; int month = 5; String name = “Pat”;

Output:

A

Wear white shoes

22
Q

if (temp >= 70 && month >= 6)
…..System.out.println(“Wear sandals \n”);
else if (name == “Pat”)
…..System.out.println(“Wear white shoes\n”);
else
…..System.out.println(“Wear black shoes\n”);

int temp= 60; int month = 6; String name = “Your name”;

Output:

A

Wear black shoes