(®) |:| Which of the following Java operators can be used with boolean variables?
Each correct answer represents a complete solution. Choose all that apply.
A +
B -~
C !
D %
E -
aa@
Cast with (boolean)
, (®) |:| Which of the following statements are correct?
Each correct answer represents a complete solution. Choose all that apply.
A D The inequality operator (=) can be used to compare objects.
8 The equality operator (- ) can be used to compare a boolean value with a numeric value.
c During runtime, the & and | operators may cause only the left side of the expression to be evaluated.
D D The return value of an assignment operation expression is the value of the newly assigned variable.
3 In Java, 0 and false may be used interchangeably.
F D The logical complement operator (}) cannot be used to flip numeric values.
G The return value of an assignment operation expression can be void.
@ What is the output of the following code snippet?
int ph = 7, vis = 2;
boolean clear = vis> 1 & (vis < 9 || ph < 2);
boolean safe = (vis> 2) && (ph++> 1);
boolean tasty = 7 <= --ph;
System.out.println(clear + "-" + safe + "-" + tasty);
A false-true-true
B j true-false-false
C true-false-true
D true-true-false
E true-true-true
F false-false-false
G false-false-true
H false-true-false
Each correct answer represents a complete solution. Choose all that apply.
A +
B -~
C !
D %
E -
aa@
Cast with (boolean)
, (®) |:| Which of the following statements are correct?
Each correct answer represents a complete solution. Choose all that apply.
A D The inequality operator (=) can be used to compare objects.
8 The equality operator (- ) can be used to compare a boolean value with a numeric value.
c During runtime, the & and | operators may cause only the left side of the expression to be evaluated.
D D The return value of an assignment operation expression is the value of the newly assigned variable.
3 In Java, 0 and false may be used interchangeably.
F D The logical complement operator (}) cannot be used to flip numeric values.
G The return value of an assignment operation expression can be void.
@ What is the output of the following code snippet?
int ph = 7, vis = 2;
boolean clear = vis> 1 & (vis < 9 || ph < 2);
boolean safe = (vis> 2) && (ph++> 1);
boolean tasty = 7 <= --ph;
System.out.println(clear + "-" + safe + "-" + tasty);
A false-true-true
B j true-false-false
C true-false-true
D true-true-false
E true-true-true
F false-false-false
G false-false-true
H false-true-false