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;
}

75.
cat < file1 >> file2 | file3

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?

Read More Section(Linux)

Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.