Question: Asstime that the following program is compiled to an executable file called getAnswer and that it is called as follows ./getAnswer 4 #include #include #include

 Asstime that the following program is compiled to an executable file
called getAnswer and that it is called as follows ./getAnswer 4 #include
#include #include #include #include #include int main (int arge, char *argvll) 1

Asstime that the following program is compiled to an executable file called getAnswer and that it is called as follows ./getAnswer 4 #include #include #include #include #include #include int main (int arge, char *argvll) 1 int pid; int err; inti, n; int status: char buf(10): i = atoi (argv[1]); pid = fork(); if (pid == 0) { if (i == 1) exit (1): sprintf (buf, "%d", 1 - 1); err = execl ("/getAnswer", "getAnswer", buf,"8". NULL); if (err == -1) exit (2); 3 else { err = waitpid(-1, &status, 0); n = WEXITSTATUS (status) "i; if (argc 3) exit (n): else printf ("Result = %d ", n); Predict the output by selecting from the following alternatives: Result = 1 Result = 5 Result = 3 Result = 0 Result = 2 Result = 12 Result - 4 Result = 6 Result = 24 Onone of these

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!