Question: estion 1 Consider the C program below. ( For space reasons, we are not checking error return codes, so assume that all functions return normally.

estion1
Consider the C program below. (For space reasons, we are not checking error return codes, so assume
that all functions return normally.)
int main (){
if (fork()==0){
if (fork()==0){
printf("3");
}
else {
pid_t pid; int status;
if ((pid = wait(&status))>0){
printf("4");
}
}
}
else {
printf("2");
exit(0);
}
printf("0");
return 0;
}
For each of the following strings, circle whether (Y) or not (N) this string is a possible output of the
program.
A.32040 Y N
B.34002 Y N
C.30402 Y N
D.23040 Y N
E.40302 Y

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 Finance Questions!