Question: What is printed by the following program assuming that the fork and exec are both completed successfully and that the echo program produces no output?

What is printed by the following program assuming that the fork and exec are both completed successfully and that the echo program produces no output? Choose all possible answers [;; means new line in the answers shown.]

main() {

pid_t pid;

if ((pid=fork()) == -1) {

} else if (pid==0){

execl(/bin/echo, /bin/echo, , NULL);

printf(Sammy );

}

printf(oh No! );

wait();

printf(Jane here );

return EXIT_SUCCESS;

}

A. Sammy ;; oh No!

B. oh No! ;; Sammy ;; Jane here

C. Sammy

D. Sammy ;; oh No! ;; Jane here

E. oh No! ;; Jane here

===================================================

Please ANSWER IN DETAILS to get upvote

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!