Q361
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
19/50
Page
Pick an option on a question to see the right answer and solution.
Q361
Open questionSelect an option to see the answer and solution.
Q362
Open questionSelect an option to see the answer and solution.
Q363
Open questionSelect an option to see the answer and solution.
Q364
Open question#include<stdio.h>
#include<sys/types.h>
#include<sys/un.h>
#include<sys/socket.h>
int main()
{
struct sockaddr_un add_server, add_client;
int fd_server, fd_client;
int len;
char ch;
fd_server = socket(AF_UNIX,SOCK_STREAM,0);
if(fd_server == -1)
perror("socket");
add_server.sun_family = AF_UNIX;
strcpy(add_server.sun_path,"demo_sock");
if( bind(fd_server,(struct sockaddr*)&add_server,sizeof(add_server)) != 0)
perror("bind");
if( listen(fd_server,3) != 0)
perror("listen");
len = sizeof(add_client);
fd_client = accept(fd_server,(struct sockaddr*)&add_client,&len);
printf("Example\n");
return 0;
}Select an option to see the answer and solution.
Q365
Open questionSelect an option to see the answer and solution.
Q366
Open questionSelect an option to see the answer and solution.
Q367
Open questionSelect an option to see the answer and solution.
Q368
Open questionSelect an option to see the answer and solution.
Q369
Open questionSelect an option to see the answer and solution.
Q370
Open questionSelect an option to see the answer and solution.
Q371
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,IPC_RMID,myun);
semctl(sem_id,0,SETVAL,myun);
sem_p();
printf("Example\n");
sem_v();
return 0;
}Select an option to see the answer and solution.
Q372
Open questionSelect an option to see the answer and solution.
Q373
Open questionSelect an option to see the answer and solution.
Q374
Open questionSelect an option to see the answer and solution.
Q375
Open questionSelect an option to see the answer and solution.
Q376
Open questionSelect an option to see the answer and solution.
Q377
Open questionSelect an option to see the answer and solution.
Q378
Open questionSelect an option to see the answer and solution.
Q379
Open questionSelect an option to see the answer and solution.
Q380
Open questionSelect an option to see the answer and solution.