edited by
793 views
0 votes
0 votes
void main()
{
int n = 1;

if(fork()==0)
  {
    n = n<<1;
    printf(“%d, “, n);
    n = n <<1;
  }
if(fork()==0)

    n=n+700;

    printf(“%d, “,n);

}


Which of the following output is not possible?

  1. 2,4,1,701,704
  2. 1,2,4,704,701
  3. 2,704,4,701,1
  4. 1,704,2,4,701
edited by

1 Answer

0 votes
0 votes

 

As all five values are possible .

Due to context switch every option is Possible.

So i think none is wrong.

Related questions

2 votes
2 votes
3 answers
3
Philosophical_Virus asked Dec 10, 2023
930 views
Int main (){fork();printf("a");fork();printf("b");return 0;}How many distinct outputs are possible of above code? And also give outputs