#include&lt;stdio.h&gt;   #include&lt;pthread.h&gt;   #include&lt;semaphore.h&gt;&nbsp;   sem_t st;   void *fun_t&#40;void *arg&#41;;   void *fun_t&#40;void *arg&#41;   &#123;       printf&#40;&quot;Linux\n&quot;&#41;;       pthread_exit&#40;&quot;Bye&quot;&#41;;   &#125;   int main&#40;&#41;   &#123;       pthread_t pt;       void *res_t;       if&#40;pthread_create&#40;&amp;pt,NULL,fun_t,NULL&#41; == -1&#41;           perror&#40;&quot;pthread_create&quot;&#41;;       if&#40;sem_init&#40;&amp;st,0,2&#41; != 0&#41;           perror&#40;&quot;sem_init&quot;&#41;;       if&#40;sem_wait&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_wait&quot;&#41;;       printf&#40;&quot;Sanoundry\n&quot;&#41;;       if&#40;sem_wait&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_wait&quot;&#41;;       if&#40;pthread_join&#40;pt,&amp;res_t&#41; == -1&#41;           perror&#40;&quot;pthread_join&quot;&#41;;       if&#40;sem_destroy&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_destroy&quot;&#41;;       return 0;   &#125;
A. this program will print the only string “Linux”
B. this program will print the only string “Sanfoundry”
C. this program will print both the strings “Linux” and “Sanfoundry”
D. none of the mentioned
Answer:A
#include&lt;stdio.h&gt;   #include&lt;pthread.h&gt;   #include&lt;semaphore.h&gt;&nbsp;   sem_t st;   void *fun_t&#40;void *arg&#41;;   void *fun_t&#40;void *arg&#41;   &#123;       printf&#40;&quot;Linux\n&quot;&#41;;       pthread_exit&#40;&quot;Bye&quot;&#41;;   &#125;   int main&#40;&#41;   &#123;       pthread_t pt;       void *res_t;       if&#40;pthread_create&#40;&amp;pt,NULL,fun_t,NULL&#41; == -1&#41;           perror&#40;&quot;pthread_create&quot;&#41;;       if&#40;sem_init&#40;&amp;st,0,2&#41; != 0&#41;           perror&#40;&quot;sem_init&quot;&#41;;       if&#40;sem_wait&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_wait&quot;&#41;;       printf&#40;&quot;Sanoundry\n&quot;&#41;;       if&#40;sem_wait&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_wait&quot;&#41;;       if&#40;pthread_join&#40;pt,&amp;res_t&#41; == -1&#41;           perror&#40;&quot;pthread_join&quot;&#41;;       if&#40;sem_destroy&#40;&amp;st&#41; != 0&#41;           perror&#40;&quot;sem_destroy&quot;&#41;;       return 0;   &#125;
A. this program will print the only string “Linux” B. this program will print the only string “Sanfoundry” C. this program will print both the strings “Linux” and “Sanfoundry” D. none of the mentioned
Explanation:The initial value of semaphore is 2. Hence sem_wait() will only decrement the value of semaphore and the process will not block.