71. What is the output of this program?
#include<stdio.h>
#include<pthread.h>
#include<fcntl.h>
int fd;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
char buff[10];
int count;
count = read(fd,buff,10);
printf("%d\n",count);
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
fd = open("demo.c",O_RDONLY);
if(pthread_create(&pt,NULL,fun_t,NULL) != 0)
perror("pthread_create");
if(pthread_join(pt,&res_t) != 0)
perror("pthread_join");
return 0;
}
#include<stdio.h>
#include<pthread.h>
#include<fcntl.h>
int fd;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
char buff[10];
int count;
count = read(fd,buff,10);
printf("%d\n",count);
pthread_exit("Bye");
}
int main()
{
pthread_t pt;
void *res_t;
fd = open("demo.c",O_RDONLY);
if(pthread_create(&pt,NULL,fun_t,NULL) != 0)
perror("pthread_create");
if(pthread_join(pt,&res_t) != 0)
perror("pthread_join");
return 0;
}
72. In sysfs.h which one of the following structure represents the directory entries?
73. How do you get help about the command "cp"?
74. Which one of the following command can list the symbols defined in a library?
75. cat < file1 >> file2 | file3
76. While debugging with GDB, arguments to the program can be specified by the arguments of . . . . . . . . command.
77. What is the output of the following program?
x = 3; y = 5; z = 10;
if [( $x -eq 3 ) -a ( $y -eq 5 -o $z -eq 10 )]
then
echo $x
else
echo $y
fi
x = 3; y = 5; z = 10;
if [( $x -eq 3 ) -a ( $y -eq 5 -o $z -eq 10 )]
then
echo $x
else
echo $y
fi
78. Which command identifies the resource of a command?
79. File descriptor table indexes which kernel structure?
80. Below is the code
int main()
{
int fd1, fd2;
struct stat buff1, buff2;
fd1 = open(“1.txt”, O_RDWR);
fd2 = open(“2.txt”, O_RDWR | O_APPEND);
lseek(fd1, 10000, SEEK_SET);
write(fd1, “abcdefghij”, 10);
write(fd2, “abcdefghij”, 10);
fstat(fd1, &buff1);
fstat(fd2, &buff2);
printf(“ %d %d”, buff1.st_size, buff2.st_size);
return 0;
}
Before running the program, the file 1.txt and 2.txt size is 20 each. What is the output?
int main()
{
int fd1, fd2;
struct stat buff1, buff2;
fd1 = open(“1.txt”, O_RDWR);
fd2 = open(“2.txt”, O_RDWR | O_APPEND);
lseek(fd1, 10000, SEEK_SET);
write(fd1, “abcdefghij”, 10);
write(fd2, “abcdefghij”, 10);
fstat(fd1, &buff1);
fstat(fd2, &buff2);
printf(“ %d %d”, buff1.st_size, buff2.st_size);
return 0;
}
Before running the program, the file 1.txt and 2.txt size is 20 each. What is the output?Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.