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?
a) 30 30
b) 100020 20
c) 100030 30
d) 100010 30
Submitted by: Murtazad) 100010 30
Submitted by: Murtaza
Submitted by: Murtaza
Read Online Linux OS Management Job Interview Questions And Answers
Top Linux OS Management Questions
☺ | Which option of rmdir command will remove all directories a, b, c if path is a/b/c: |
☺ | Which of the following time stamps need not exist for a file on traditional unix file system: |
☺ | When mv f1 f2 is executed which file\'s inode is freed? |
☺ | What is the default maximum number of processes that can exist in Linux? |
Top Linux OS Categories
☺ | Device Drivers Interview Questions. |
☺ | Linux OS Management Interview Questions. |
☺ | Linux Makefile Interview Questions. |
☺ | Linux Environment Interview Questions. |
☺ | Linux OS Shell Interview Questions. |