Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions