24.
What is the output of this program?
#include<stdio.h>
#inlcude<stdlib.h>
 
int main()
{
    int *ptr;
    double *ptr;
    printf("%d\n",sizeof(ptr));
    return 0;	   
}

27.
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
 
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\n",data2.buff);
    if(msgctl(m_id,IPC_RMID,0) != 0)
        perror("msgctl");
    return 0;
}

28.
What is the output of this progarm?
#include<stdio.h>
#include<unistd.h>
 
int main()
{
    execl("/bin/ls","ls",NULL);
    return 0;
}

30.
In which condition this program will print the string "Example"?
#include<stdio.h>
#include<stdlib.h>
 
int main()
{
    int *ptr;
    ptr = (int *)malloc(sizeof(int)*10);
    if (ptr == NULL)
        printf("Example\n");
    return 0;
}

Read More Section(Linux)

Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.