Question: I need help answering these four questions for computer science. (If you could give a little detail on why each is the answer that would

I need help answering these four questions for computer science.

(If you could give a little detail on why each is the answer that would be great):

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

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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!