Question: 4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is /usr/local, How many times should the sign -

 4. The following program (test.c) was compiled and run as shown

4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is "/usr/local", How many times should the sign "-" be printed when we run the program? Explain your answer. #include #include int main(char* argv[]. int argc) int num = atoi(argv[1]); char *argv2[] = {"test" , "O", NULL }; int i; for (i-t isum; 1++) if (fork) !=0) { execv("/ust/local/test", argv2); forkO fork0: execv(/usr/local/test", argv2); printff-); return 0 The shell commands executed are: gcc-g-o test test.c /test 3 4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is "/usr/local", How many times should the sign "-" be printed when we run the program? Explain your answer. #include #include int main(char* argv[]. int argc) int num = atoi(argv[1]); char *argv2[] = {"test" , "O", NULL }; int i; for (i-t isum; 1++) if (fork) !=0) { execv("/ust/local/test", argv2); forkO fork0: execv(/usr/local/test", argv2); printff-); return 0 The shell commands executed are: gcc-g-o test test.c /test 3

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!