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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started