91. What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int main()
{
int fd;
char *buff;
buff = (char *)malloc(sizeof(char)*5);
fd = open("example.txt",O_RDWR|O_CREAT);
write(fd,"Linux",5);
read(fd,buff,5);
printf("%s\n",buff);
}
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int main()
{
int fd;
char *buff;
buff = (char *)malloc(sizeof(char)*5);
fd = open("example.txt",O_RDWR|O_CREAT);
write(fd,"Linux",5);
read(fd,buff,5);
printf("%s\n",buff);
}
92. Which is an example for block special file?
93. /proc/partitions contains
94. What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int ptr;
ptr = (int)malloc(sizeof(int)*10);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int ptr;
ptr = (int)malloc(sizeof(int)*10);
return 0;
}
95. Which of the following commands can be used to copy files across systems?
96. What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, fd2, ret;
fd = open("hello.c",O_RDONLY);
ret = close(fd2);
printf("%d\n",ret);
}
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, fd2, ret;
fd = open("hello.c",O_RDONLY);
ret = close(fd2);
printf("%d\n",ret);
}
97. Which option is used by sed to specify that the following string is an instruction or set of instructions?
98. What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<semaphore.h>
int main()
{
sem_t* sem_id;
sem_id = sem_open("sem_value",O_CREAT,0666,0);
if(sem_id == SEM_FAILED)
perror("sem_open");
sem_post(sem_id);
printf("Example\n");
if(sem_close(sem_id) == -1)
perror("sem_close");
return 0;
}
#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<semaphore.h>
int main()
{
sem_t* sem_id;
sem_id = sem_open("sem_value",O_CREAT,0666,0);
if(sem_id == SEM_FAILED)
perror("sem_open");
sem_post(sem_id);
printf("Example\n");
if(sem_close(sem_id) == -1)
perror("sem_close");
return 0;
}
99. what is the output if the who command displays like this
who | cut –d ” ” -f1
who | cut –d ” ” -f1
100. The command "sed -n '/example/p' old.txt" will
Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.