Question: When compiling and running the following program, select which of the following statement (s) is true? #include #include #include #include #include #include #include #include int

When compiling and running the following program, select which of the following statement (s) is true?

#include  #include  #include  #include  #include  #include  #include  #include  int id; struct Mesg{ char message[40]; int count; char token[10][20]; char sorttoken[10][20]; }; #define KEY ((key_t)(713)) #define SEGSIZE sizeof(struct Mesg) void cleanup(int sigtype){ shmdt(0); printf(" Terminating "); execlp("ipcrm","ipcrm","-M","713",(char*)(0)); printf("ERROR!"); exit(0); } int main(int argc, char *argv[]){ int i,j; int count; char *token; char tmp[20]; struct Mesg *msg; struct shmid_ds shmbuf; signal(SIGINT,cleanup); signal(SIGQUIT,cleanup); id=shmget(KEY,SEGSIZE,IPC_CREAT|0666); if(idcount=0; strcpy(msg->message, "Welcome to COEN 177 Operating Systems"); count = strlen(msg->message); if(fork()==0){ msg->count=1; for(i=0;imessage[i]==' ') msg->count++; exit(0); } else if(fork()==0){ i=0; token=strtok(msg->message," "); while(token!=NULL){ strcpy(msg->token[i],token); i++; token=strtok(NULL," "); } exit(0); }else if(fork()==0){ for(i=0;icount;i++){ strcpy(tmp,msg->token[i]); strcpy(msg->sorttoken[i],tmp); } for(i=msg->count-1;i>=0;i--){ for(j=0;jsorttoken[j],msg->sorttoken[j+1])>0){ strcpy(tmp,msg->sorttoken[j]); strcpy(msg->sorttoken[j],msg->sorttoken[j+1]); strcpy(msg->sorttoken[j+1],tmp); } } } for(i=0;icount;i++){ printf("%s ",msg->sorttoken[i]); } exit(0); } for(i=0;i 

When compiling and running the following program, select which of the following

The number of processing that will be running is equal to 4 The output of the program is: 177 COEN Operating Systems Welcome to The output of the program is: 177 The number of processing that will be running is equal to 8

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!