Assuming that the system call fork () never fails, consider the following C programs P1 and P2 executed on a UNIX / Linux system:

/*P1*/

Int main() {

fork ():

fork () ;

fork () ;

Printf(“Happy\n”);

}

/*P2*/

Int main() {

fork ();

Printf(“Happy\n”);

fork ()

Printf(“Happy\n”);

fork () ;

Printf(“Happy\n”);

}

Statement I: P1 displays "Happy" 8 times.

Statement II: P2 displays "Happy" 12 times.

In the light of the above statements, choose the correct answer from the options given below

1
Both Statement I and Statement II are true
2
Both Statement I and Statement II are false
3
Statement I is correct but Statement II is false
4
Statement I is incorrect but Statement II is true

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation