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
what is happening when humans control the breeeding of living things to favor certain desired features
sweet-ann [11.9K]
Selective Breeding is happening.
6 0
3 years ago
<img src="https://tex.z-dn.net/?f=%28a%20%2B%20b%29%20%20%7B2%7D" id="TexFormula1" title="(a + b) {2}" alt="(a + b) {2}" align
MariettaO [177]

Answer:

ab2

Explanation:

3 0
2 years ago
Write a program that accepts a phrase of unspecified length on the command line. For example: prompt% letter print Operating Sys
Sedaia [141]

Answer:

Check the explanation

Explanation:

#define _MULTI_THREADED

#include <pthread.h>

#include <stdio.h>

#include <errno.h>

#define           THREADS          2

int               i=1,j,k,l;

int argcG;

char *argvG[1000];

void *threadfunc(void *parm)

{

int *num;

num=(int*)parm;

while(1)

   {

   if(i>=argcG)

   break;

   if(*num ==1)

   if(argvG[i][0]=='a' ||argvG[i][0]=='2'||argvG[i][0]=='i' ||argvG[i][0]=='o' ||argvG[i][0]=='u')

   {

   printf("%s\n",argvG[i]);

   i++;

   continue;

   }

    if(*num ==2)

   if(!(argvG[i][0]=='a' ||argvG[i][0]=='2'||argvG[i][0]=='i' ||argvG[i][0]=='o' ||argvG[i][0]=='u'))

   {

   printf("%s\n",argvG[i]);

   i++;

   continue;

   }

   sched_yield();

   }

return NULL;

}

int main(int argc, char *argv[])

{

pthread_t            threadid[THREADS];

int                  rc=0;

int                  loop=0;

int arr[2]={1,2};

argcG=argc;

for(rc=0;rc<argc;rc++)

argvG[rc]=argv[rc];

printf("Creating %d threads\n", THREADS);

for (loop=0; loop<THREADS; ++loop) {

     rc =pthread_create(&threadid[loop], NULL, threadfunc,&arr[loop]);

}

for (loop=0; loop<THREADS; ++loop) {

   rc = pthread_join(threadid[loop], NULL);

}

printf("Main completed\n");

return 0;

}

The below attached image is a sample output

3 0
3 years ago
Is a class of software used to meet organization-wide business needs and typically shares data with other enterprise application
yuradex [85]

Answer:enterprise

Explanation:

5 0
1 year ago
Read 2 more answers
Name the tools in plant propagation.<br>Q<br>18.<br>16.<br>17.<br>19.<br>20.<br>please po asap​
Agata [3.3K]
16. Branch or tree cutter
17.paint tape
18. Knife
19. Pots
20. Waterer
6 0
2 years ago
Other questions:
  • After a normal system shutdown, when the computer is turned off, contents of the memory used to store bios settings are
    12·2 answers
  • How to search multiple microsoft word documents?
    15·1 answer
  • PLEASE HELP SOMEONE!!!!!!!!! WILL GIVE BRAINLIEST!!!!!!!!!!!!!!!!!!!!!!!!! Fill in the blanks.
    15·1 answer
  • Which quality allows programmers to modify a program as and when required
    11·2 answers
  • ______ is a customer-facing CRM application.<br><br> FAQ<br><br> Search<br><br> SFA<br><br> E-mail
    6·1 answer
  • Which of the following is used to move to end of the row?​
    8·1 answer
  • Generalized goals are more likely to be achieved than specific goals. True or False
    7·1 answer
  • Type the correct answer in the box
    13·1 answer
  • Question: 4/8
    11·1 answer
  • The designers of a database typically begin by developing a​ __________ to construct a logical representation of the database be
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!