Question: he expression hello.equals(hello) evaluates to: 10 points QUESTION 2 The expression hello.compareTo(hello) evaluates to: 10 points QUESTION 3 The expression hello.compareTo(hello) <0 evaluates to: 10

he expression "hello".equals("hello") evaluates to:

10 points

QUESTION 2

The expression "hello".compareTo("hello") evaluates to:

10 points

QUESTION 3

The expression "hello".compareTo("hello")<0 evaluates to:

10 points

QUESTION 4

What will this expression evaluate to: "ascending".compareTo("curious")

10 points

QUESTION 5

Assume that word is a String variable with data from the user given as follows: String word = kb.nextLine(); Mark all of the boolean expressions below that evaluate to true if the user entered the text Monday.

"word".compareTo("Monday")== 0

"monday".compareTo(word) == 0

"Monday".compareTo(word) == 0

word.compareTo("Monday")== 0

word.compareTo("MONDAY")== 0

"Monday".compareTo("word")== 0

12 points

QUESTION 6

String s1 = kb.nextLine();

s1 = "rescue";

(s1.compareTo("rescue") < 0) && ( "rescue".compareTo(s1) > 0 )

evaluates to

true

false

Neither. It crashes.

It depends on the user input.

10 points

QUESTION 7

In the expression: day.compareTo("monday") == 0 The method compareTo is called on the object day.

True

False

8 points

QUESTION 8

Call the equals method on the word object to check if it equals Tuesday . Do not put extra spaces. You MUST use the equals method, not the compareTo and you must call it on the wordobject (not viceversa). (There is only one way to do this.)

10 points

QUESTION 9

Write the boolean expression that evaluates to true if variable word has value either Tuesday or Thursday . Do not put extra empty spaces. You MUST use the equals method, and call it on the word object. You must put parenthesis around the individual questions used in the expression, e.g. : (x<8)&&(x>3)

10 points

QUESTION 10

// Assume variables data1 and data2 have already been declared.

data1 = kb.nextLine(); // assume the user enters 8

data2 = kb.nextLine(); // Assume the user enters 201

Is the statement below correct?

The expression data1.compareTo(data2)<0 evaluates to true.

Yes No

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!