#include&lt;stdio.h&gt;   #include&lt;stdlib.h&gt;   #include&lt;sys/types.h&gt;   #include&lt;sys/ipc.h&gt;   #include&lt;sys/sem.h&gt;&nbsp;   static int sem_p&#40;void&#41;;   static int sem_v&#40;void&#41;;   union semun&#123;       int val;       struct semid_ds *buf;       unsigned short array;   &#125;;   int sem_id;   struct semid_ds myds;   struct sembuf mybuf;   union semun myun;   static int sem_p&#40;void&#41;   &#123;       mybuf.sem_num = 0;       mybuf.sem_op = -1;       mybuf.sem_flg = SEM_UNDO;       semop&#40;sem_id,&amp;mybuf,1&#41;;   &#125;   static int sem_v&#40;void&#41;   &#123;       mybuf.sem_num = 0;       mybuf.sem_op = 1;       mybuf.sem_flg = SEM_UNDO;       semop&#40;sem_id,&amp;mybuf,1&#41;;   &#125;   int main&#40;&#41;   &#123;       int wfd, rfd;       sem_id = semget&#40;&#40;key_t&#41;911,1,0666 | IPC_CREAT&#41;;       myun.val = 1;       semctl&#40;sem_id,0,SETVAL,myun&#41;;       sem_p&#40;&#41;;       printf&#40;&quot;Sanfoundry\n&quot;&#41;;       sem_v&#40;&#41;;       semctl&#40;sem_id,0,IPC_RMID,myun&#41;;       return 0;   &#125;
A. this program will print the string “Sanfoundry”
B. this process will remain block
C. both (a) and (b)
D. none of the mentioned
Answer:A
#include&lt;stdio.h&gt;   #include&lt;stdlib.h&gt;   #include&lt;sys/types.h&gt;   #include&lt;sys/ipc.h&gt;   #include&lt;sys/sem.h&gt;&nbsp;   static int sem_p&#40;void&#41;;   static int sem_v&#40;void&#41;;   union semun&#123;       int val;       struct semid_ds *buf;       unsigned short array;   &#125;;   int sem_id;   struct semid_ds myds;   struct sembuf mybuf;   union semun myun;   static int sem_p&#40;void&#41;   &#123;       mybuf.sem_num = 0;       mybuf.sem_op = -1;       mybuf.sem_flg = SEM_UNDO;       semop&#40;sem_id,&amp;mybuf,1&#41;;   &#125;   static int sem_v&#40;void&#41;   &#123;       mybuf.sem_num = 0;       mybuf.sem_op = 1;       mybuf.sem_flg = SEM_UNDO;       semop&#40;sem_id,&amp;mybuf,1&#41;;   &#125;   int main&#40;&#41;   &#123;       int wfd, rfd;       sem_id = semget&#40;&#40;key_t&#41;911,1,0666 | IPC_CREAT&#41;;       myun.val = 1;       semctl&#40;sem_id,0,SETVAL,myun&#41;;       sem_p&#40;&#41;;       printf&#40;&quot;Sanfoundry\n&quot;&#41;;       sem_v&#40;&#41;;       semctl&#40;sem_id,0,IPC_RMID,myun&#41;;       return 0;   &#125;
A. this program will print the string “Sanfoundry” B. this process will remain block C. both (a) and (b) D. none of the mentioned
Explanation:The function sem_p() will increment the value of semaphore but it will not block the process.