#include&lt;stdio.h&gt;   #include&lt;stdlib.h&gt;   #include&lt;string.h&gt;   #include&lt;sys/types.h&gt;   #include&lt;sys/ipc.h&gt;   #include&lt;sys/msg.h&gt;&nbsp;   struct data_st&#123;       long int id;       char buff&#91;11&#93;;   &#125;;   int main&#40;&#41;   &#123;       int m_id;       struct data_st data1, data2;       m_id = msgget&#40;&#40;key_t&#41;181,0666|IPC_CREAT&#41;;       if&#40;m_id == -1&#41;           perror&#40;&quot;msgget&quot;&#41;;       data1.id = 1;       strcpy&#40;data1.buff,&quot;Sanfoundry&quot;&#41;;       if&#40;msgsnd&#40;m_id,&amp;data1,11,0&#41; == -1&#41;           perror&#40;&quot;msgsnd&quot;&#41;;       if&#40;msgctl&#40;m_id,IPC_RMID,0&#41; != 0&#41;           perror&#40;&quot;msgctl&quot;&#41;;       if&#40;msgrcv&#40;m_id,&amp;data2,11,1,0&#41; == -1&#41;           perror&#40;&quot;msgrcv&quot;&#41;;       printf&#40;&quot;%s\n&quot;,data2.buff&#41;;       return 0;   &#125;
A. this program will print the string “Sanfoundry”
B. this program will print the garbage value
C. this program will give segmentation fault
D. none of the mentioned
Answer:A
#include&lt;stdio.h&gt;   #include&lt;stdlib.h&gt;   #include&lt;string.h&gt;   #include&lt;sys/types.h&gt;   #include&lt;sys/ipc.h&gt;   #include&lt;sys/msg.h&gt;&nbsp;   struct data_st&#123;       long int id;       char buff&#91;11&#93;;   &#125;;   int main&#40;&#41;   &#123;       int m_id;       struct data_st data1, data2;       m_id = msgget&#40;&#40;key_t&#41;181,0666|IPC_CREAT&#41;;       if&#40;m_id == -1&#41;           perror&#40;&quot;msgget&quot;&#41;;       data1.id = 1;       strcpy&#40;data1.buff,&quot;Sanfoundry&quot;&#41;;       if&#40;msgsnd&#40;m_id,&amp;data1,11,0&#41; == -1&#41;           perror&#40;&quot;msgsnd&quot;&#41;;       if&#40;msgctl&#40;m_id,IPC_RMID,0&#41; != 0&#41;           perror&#40;&quot;msgctl&quot;&#41;;       if&#40;msgrcv&#40;m_id,&amp;data2,11,1,0&#41; == -1&#41;           perror&#40;&quot;msgrcv&quot;&#41;;       printf&#40;&quot;%s\n&quot;,data2.buff&#41;;       return 0;   &#125;
A. this program will print the string “Sanfoundry” B. this program will print the garbage value C. this program will give segmentation fault D. none of the mentioned
Explanation:The message queue has been removed before recieving the message. Hence the program prints the grabage value of the buffer.