Q421
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
996
Questions
22/50
Page
Pick an option on a question to see the right answer and solution.
Q421
Open questionSelect an option to see the answer and solution.
Q422
Open questionSelect an option to see the answer and solution.
Q423
Open questionSelect an option to see the answer and solution.
Q424
Open question#include<stdio.h>
#inlcude<stdlib.h>
int main()
{
int *ptr;
double *ptr;
printf("%d\n",sizeof(ptr));
return 0;
}Select an option to see the answer and solution.
Q425
Open questionSelect an option to see the answer and solution.
Q426
Open questionSelect an option to see the answer and solution.
Q427
Open question#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;
}Select an option to see the answer and solution.
Q428
Open question#include<stdio.h>
#include<unistd.h>
int main()
{
execl("/bin/ls","ls",NULL);
return 0;
}Select an option to see the answer and solution.
Q429
Open questionSelect an option to see the answer and solution.
Q430
Open question#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
if (ptr == NULL)
printf("Example\n");
return 0;
}Select an option to see the answer and solution.
Q431
Open questionSelect an option to see the answer and solution.
Q432
Open questionSelect an option to see the answer and solution.
Q433
Open questionSelect an option to see the answer and solution.
Q434
Open questionSelect an option to see the answer and solution.
Q435
Open questionSelect an option to see the answer and solution.
Q436
Open questionSelect an option to see the answer and solution.
Q437
Open questionSelect an option to see the answer and solution.
Q438
Open questionSelect an option to see the answer and solution.
Q439
Open questionSelect an option to see the answer and solution.
Q440
Open question#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/sem.h>
static int sem_p(void);
static int sem_v(void);
union semun{
int val;
struct semid_ds *buf;
unsigned short array;
};
int sem_id;
struct semid_ds myds;
struct sembuf mybuf;
union semun myun;
static int sem_p(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = -1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
static int sem_v(void)
{
mybuf.sem_num = 0;
mybuf.sem_op = 1;
mybuf.sem_flg = SEM_UNDO;
semop(sem_id,&mybuf,1);
}
int main()
{
int wfd, rfd;
sem_id = semget((key_t)911,1,0666 | IPC_CREAT);
myun.val = 0;
semctl(sem_id,0,SETVAL,myun);
sem_p();
printf("Example\n");
sem_v();
semctl(sem_id,0,IPC_RMID,myun);
return 0;
}Select an option to see the answer and solution.