1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BlackZzzverrR [31]
3 years ago
6

Which expression correctly determines that String s1 comes before String s2 in lexicographical order

Computers and Technology
1 answer:
Assoli18 [71]3 years ago
8 0

Options :

A.) s1 < s2

B.) s1 <= s2

C.) s1.compareTo(s2) == −1

D.) s2.compareTo(s1) < 0

E.) s1.compareTo(s2) < 0

Answer: E.) s1.compareTo(s2) < 0

Explanation: Lexicographical ordering simply means the arrangement of strings based on the how the alphabets or letters of the strings appear. It could also be explained as the dictionary ordering principle of words based on the arrangement of the alphabets. In making lexicographical comparison between strings, the compareTo () method may be employed using the format below.

If first string = s1 ; second string = s2

To compare s1 with s2, the format is ;

s1.compareTo(s2) ;

If s1 comes first, that is, before s2, the method returns a negative value, that is a value less than 0 '< 0', which is the case in the question above.

If s2 comes first, that is, before s1, the method returns a positive value, that is a value greater than 0 '> 0'.

If both are s1 and s2 are the same, the output will be 0.

You might be interested in
EASY In the image, what will be the result of pressing the Delete key
kaheart [24]
D would be the answer
7 0
3 years ago
Read 2 more answers
Select the correct answer.
Naddika [18.5K]

Answer:

E

Explanation:

4 0
3 years ago
Consider the following Stack operations:
maxonik [38]

Answer:

Sequence of popped values: h,s,f.

State of stack (from top to bottom): m, d

Explanation:

Assuming that stack is  initially empty. Suppose that p contains the popped values. The state of the stack is where the top and bottom are pointing to in the stack. The top of the stack is that end of the stack where the new value is entered and existing values is removed. The sequence works as following:

push(d) -> enters d to the Stack

Stack:  

d ->top

push(h) -> enters h to the Stack

Stack:

h ->top

d ->bottom

pop() -> removes h from the Stack:

Stack:

d ->top

p: Suppose p contains popped values so first popped value entered to p is h

p = h

push(f) -> enters f to the Stack

Stack:

f ->top

d ->bottom

push(s) -> enters s to the Stack

Stack:

s ->top

f

d ->bottom

pop() -> removes s from the Stack:

Stack:

f ->top

d -> bottom

p = h, s

pop() -> removes f from the Stack:

Stack:

d ->top

p = h, s, f

push(m) -> enters m to the Stack:

Stack:

m ->top

d ->bottom

So looking at p the sequence of popped values is:

h, s, f

the final state of the stack:

m, d

end that is the top of the stack:

m

6 0
3 years ago
When sharing a file or folder with someone not in your __________ , you need to input the __________ of the recipient.
Ede4ka [16]
Group, name is the answer
6 0
4 years ago
Read 2 more answers
What is the Median Pay of Advertising, Promotions, or Marketing Managers?
NemiM [27]

Answer:

it is 125.510$ per yr but try B see if its correct

6 0
3 years ago
Read 2 more answers
Other questions:
  • To apply the rule of thirds you first? PLZ HURRY AND ANSWER THIS
    5·2 answers
  • Why is art important to heritage?
    10·1 answer
  • Elena is used to kissing her friends on both cheeks as a form of greeting in her native country. She notices that her new friend
    6·1 answer
  • An online company wants to conduct real-time sentiment analysis about its products from its social media channels using SQL.
    12·1 answer
  • At age 16 Cheyanne just got her drivers license
    5·2 answers
  • Which type of image would require you to obtain permission from the author to use the image and possibly pay a royalty to the au
    12·1 answer
  • Help please! I need help with this question, it’s very hard.
    10·1 answer
  • What are the benefits of writing functions that use parameters and return? Try to list at least two.
    12·1 answer
  • Which of the following is true about advertisements?
    15·1 answer
  • What is a true job in the information age?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!