Q301
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
16/50
Page
Pick an option on a question to see the right answer and solution.
Q301
Open questionSelect an option to see the answer and solution.
Q302
Open questionSelect an option to see the answer and solution.
Q303
Open questionSelect an option to see the answer and solution.
Q304
Open questionSelect an option to see the answer and solution.
Q305
Open questionSelect an option to see the answer and solution.
Q306
Open question#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<sys/mman.h>
int main()
{
int s_id;
int *ptr;
s_id = shm_open("shared_mem",O_CREAT|O_RDWR,0666);
if(s_id == -1)
perror("shm_open");
ptr = mmap(NULL,100,PROT_WRITE,MAP_PRIVATE,s_id,0);
if(ptr == MAP_FAILED);
perror("mmap");
if(munmap(ptr,100) == -1)
perror("munmap");
if(shm_unlink("shared_mem") == -1)
perror("shm_unlink");
return 0;
}Select an option to see the answer and solution.
Q307
Open question#include<stdio.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
int main()
{
int fd_client,fd, len;
struct sockaddr_in add_server;
fd_client = socket(AF_INET,SOCK_STREAM,0);
if (fd_client == -1)
{
perror("fd_sock");
exit(1);
}
add_server.sin_family = AF_INET;
add_server.sin_port = ntohs(4001);
add_server.sin_addr.s_addr = inet_addr("193.39.0.4");
len = sizeof(add_server);
fd = connect(fd_client,(struct sockaddr*)&add_server,len);
if(fd == -1)
perror("connect");
return 0;
}Select an option to see the answer and solution.
Q308
Open question#include<stdio.h>
#include<signal.h>
void response(int);
void response(int sig_no)
{
printf("Linux\n");
signal(SIGINT,SIG_DFL);
}
int main()
{
signal(SIGINT,response);
while(1){
printf("Example\n");
sleep(1);
}
return 0;
}Select an option to see the answer and solution.
Q309
Open questionSelect an option to see the answer and solution.
Q310
Open questionSelect an option to see the answer and solution.
Q311
Open questionSelect an option to see the answer and solution.
Q312
Open questionSelect an option to see the answer and solution.
Q313
Open questionSelect an option to see the answer and solution.
Q314
Open questionSelect an option to see the answer and solution.
Q315
Open questionSelect an option to see the answer and solution.
Q316
Open questionSelect an option to see the answer and solution.
Q317
Open questionSelect an option to see the answer and solution.
Q318
Open questionSelect an option to see the answer and solution.
Q319
Open questionSelect an option to see the answer and solution.
Q320
Open question#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int main()
{
int fd, new_fd;
char *buff;
buff = (char *)malloc(sizeof(char)*8);
fd = open("test.c",O_RDONLY);
new_fd = dup(fd);
close(fd);
read(new_fd,buff,8);
printf("%s\n",buff);
}Select an option to see the answer and solution.