Question: Question 1. Assume the following (int) values for a set of variables: a = 5; b = 17; c = 27; d = -1; Then,
Question 1. Assume the following (int) values for a set of variables:
a = 5; b = 17; c = 27; d = -1;
Then, does the following boolean expression evaluate as true or false?
((a < 5) && (b > 10)) || ((c < 3) || (d < 0))
| a. | false | |
| b. | true |
QUESTION 2
If you want to compare the String variable myvar and the literal "Yes" which boolean expression would you use? __________________________.
| a. | (myvar is "Yes") | |
| b. | ("Yes".equals(myvar)) | |
| c. | (myvar == Yes) | |
| d. | None of the above |
QUESTION 3
The following is a syntactically correct Java if statement.
if (rand == 1) { c_pick = ROCK; } else if (rand == 2) { c_pick = PAPER; } else { c_pick = SCISSORS } }
| a. | false | |
| b. | true |
QUESTION 4
Which of the following can be used in the boolean condition of a Java if statement? ___________________.
| a. | <, <=, >, >= | |
| b. | ==, != | |
| c. | &&, || | |
| d. | All of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
