Q427
What is the output of this program? #include #include #include #include #include #include struct data_st long int id; char buff[11]; ; int main() int m_id; struct data_st data1, data2; m_id = msgget((key_t)181,0666|IPC_CREAT); if(m_id == -1) perror("msgget"); data1.id = 1; strcpy(data1.buff,"example"); if(msgsnd(m_id,&data1,11,0) == -1) perror("msgsnd"); if(msgrcv(m_id,&data2,11,0) == -1) perror("msgrcv"); printf("%s ",data2.buff); if(msgctl(m_id,IPC_RMID,0) != 0) perror("msgctl"); return 0;
A.
this program will print the string "example"
B.
this program will give an error
AnswerC.
this program will give segmentaion fault
D.
none of the mentioned
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board