/*This is san1.c*/    #include&lt;stdio.h&gt;    #include&lt;sys/ipc.h&gt;    #include&lt;sys/shm.h&gt;    #include&lt;string.h&gt;&nbsp;    int main&#40;&#41;    &#123;        int shm_id;        char *addr;        struct shmid_ds ds;        shm_id = shmget&#40;&#40;key_t&#41;1234,10,0666|IPC_CREAT&#41;;        if&#40;shm_id == -1&#41;&#123;            perror&#40;&quot;shmget&quot;&#41;;        &#125;        addr = &#40;char*&#41;shmat&#40;shm_id,NULL,SHM_RND&#41;;        if&#40;addr == &#40;char *&#41;-1&#41;&#123;            perror&#40;&quot;shmat&quot;&#41;;        &#125;        strcpy&#40;addr,&quot;Sanfoundry&quot;&#41;;        if &#40;shmdt&#40;addr&#41; != 0&#41;&#123;            perror&#40;&quot;shmdt&quot;&#41;;        &#125;        sleep&#40;10&#41;;              if&#40; shmctl&#40;shm_id,IPC_RMID,0&#41; == -1&#41;&#123;            perror&#40;&quot;shmctl&quot;&#41;;        &#125;        return 0;    &#125;    /*This is san2.c*/    #include&lt;stdio.h&gt;    #include&lt;sys/ipc.h&gt;    #include&lt;sys/shm.h&gt;&nbsp;    int main&#40;&#41;    &#123;        int shm_id;        char *addr;        struct shmid_ds ds;        shm_id = shmget&#40;&#40;key_t&#41;111,10,0666|IPC_CREAT&#41;;        if&#40;shm_id == -1&#41;&#123;            perror&#40;&quot;shmget&quot;&#41;;        &#125;         addr = &#40;char*&#41;shmat&#40;shm_id,NULL,SHM_RND&#41;;        if&#40;addr == &#40;char *&#41;-1&#41;&#123;            perror&#40;&quot;shmat&quot;&#41;;        &#125;         printf&#40;&quot;%s\n&quot;,addr&#41;;        if &#40;shmdt&#40;addr&#41; != 0&#41;&#123;            perror&#40;&quot;shmdt&quot;&#41;;        &#125;        return 0;     &#125;
A. the program will print the string “Sanfoundry”
B. the program will nothing
C. segmentaion fault
D. none of the mentioned
Answer:A
/*This is san1.c*/    #include&lt;stdio.h&gt;    #include&lt;sys/ipc.h&gt;    #include&lt;sys/shm.h&gt;    #include&lt;string.h&gt;&nbsp;    int main&#40;&#41;    &#123;        int shm_id;        char *addr;        struct shmid_ds ds;        shm_id = shmget&#40;&#40;key_t&#41;1234,10,0666|IPC_CREAT&#41;;        if&#40;shm_id == -1&#41;&#123;            perror&#40;&quot;shmget&quot;&#41;;        &#125;        addr = &#40;char*&#41;shmat&#40;shm_id,NULL,SHM_RND&#41;;        if&#40;addr == &#40;char *&#41;-1&#41;&#123;            perror&#40;&quot;shmat&quot;&#41;;        &#125;        strcpy&#40;addr,&quot;Sanfoundry&quot;&#41;;        if &#40;shmdt&#40;addr&#41; != 0&#41;&#123;            perror&#40;&quot;shmdt&quot;&#41;;        &#125;        sleep&#40;10&#41;;              if&#40; shmctl&#40;shm_id,IPC_RMID,0&#41; == -1&#41;&#123;            perror&#40;&quot;shmctl&quot;&#41;;        &#125;        return 0;    &#125;    /*This is san2.c*/    #include&lt;stdio.h&gt;    #include&lt;sys/ipc.h&gt;    #include&lt;sys/shm.h&gt;&nbsp;    int main&#40;&#41;    &#123;        int shm_id;        char *addr;        struct shmid_ds ds;        shm_id = shmget&#40;&#40;key_t&#41;111,10,0666|IPC_CREAT&#41;;        if&#40;shm_id == -1&#41;&#123;            perror&#40;&quot;shmget&quot;&#41;;        &#125;         addr = &#40;char*&#41;shmat&#40;shm_id,NULL,SHM_RND&#41;;        if&#40;addr == &#40;char *&#41;-1&#41;&#123;            perror&#40;&quot;shmat&quot;&#41;;        &#125;         printf&#40;&quot;%s\n&quot;,addr&#41;;        if &#40;shmdt&#40;addr&#41; != 0&#41;&#123;            perror&#40;&quot;shmdt&quot;&#41;;        &#125;        return 0;     &#125;
A. the program will print the string “Sanfoundry” B. the program will nothing C. segmentaion fault D. none of the mentioned
Explanation:The process of san1.c has written the string “Sanfoundry” in the shared memory and the process of san2.c could not access that shared memory because the key is different.