Q521
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
27/50
Page
Pick an option on a question to see the right answer and solution.
Q521
Open questionSelect an option to see the answer and solution.
Q522
Open questionSelect an option to see the answer and solution.
Q523
Open question#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, count;
char ch;
fd = open("demo.txt",O_RDWR|O_CREAT);
write(fd,"s",1);
lseek(fd,0,SEEK_SET);
write(fd,"d",1);
lseek(fd,0,0);
read(fd,&ch,1);
printf("%c\n",ch);
return 0;
}Select an option to see the answer and solution.
Q524
Open questionSelect an option to see the answer and solution.
Q525
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");
ptr = mmap(ptr,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.
Q526
Open question#include<stdio.h>
#include<string.h>
int main()
{
int fd[2];
int count;
char buffer[6];
if( pipe(fd) != 0)
perror("pipe");
memset(buffer,'\0',6);
count=write(fd[1],"Linux",6);
read(fd[0],buffer,6);
printf("%s\n",buffer);
return 0;put
}Select an option to see the answer and solution.
Q527
Open questionSelect an option to see the answer and solution.
Q528
Open question#include<stdio.h>
#include<signal.h>
#include<unistd.h>
void response (int);
void response (int sig_no)
{
printf("%s is working\n",sys_siglist[sig_no]);
}
int main()
{
alarm(5);
sleep(50);
printf("Example\n");
signal(SIGALRM,response);
return 0;
}Select an option to see the answer and solution.
Q529
Open questionSelect an option to see the answer and solution.
Q530
Open question#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr1, *ptr2;
ptr1 = malloc(4);
*ptr1 = 10;
*ptr2 = free(ptr1);
printf("%d\n",*ptr2);
return 0;
}Select an option to see the answer and solution.
Q531
Open questionSelect an option to see the answer and solution.
Q532
Open questionSelect an option to see the answer and solution.
Q533
Open questionSelect an option to see the answer and solution.
Q534
Open questionSelect an option to see the answer and solution.
Q535
Open questionSelect an option to see the answer and solution.
Q536
Open questionSelect an option to see the answer and solution.
Q537
Open questionSelect an option to see the answer and solution.
Q538
Open questionSelect an option to see the answer and solution.
Q539
Open question#include<stdio.h>
#include<stdlib.h>
struct st{
int a;
char b;
};
int main()
{
struct st *st_ptr;
st_ptr = malloc(sizeof(struct st));
printf("%d\n",sizeof(struct st));
return 0;
}Select an option to see the answer and solution.
Q540
Open questionSelect an option to see the answer and solution.