⟩ The preprocessor creates the file with extension a) .a b) .i c) .s d) .o
b) .i
b) .i
Switch table is used by a) device special file b) directory file c) fifo d) link file.
Printf() uses which system call a) open b) read c) write d) close
Which system call is used to create a hard link? a) hard-link b) link c) symlink d) ln
dup2(1,0) a) closes the stdout and copies the stdin descriptor to stdout b) closes the stdin and copies the stdout descriptor to stdin c) will produce compilation error d) None of the above
If the fork() system call returns -1, then it means? a) No new child process is created b) The child process is an orphan c) The child process is in Zombie
Which function can be used instead of the dup2 to duplicate the file descriptor? a) read() b) open() c) stat() d) fcntl()
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
Code snippets str1="45678n" str2="123n" f1 = fopen(file1,RDWR,RWX) f2 = fopen(file1,RDWR,RWX) write(f1,str1,len_str1) write(f2,str2,len_str2) o/p a) 12378 b) 123(newline)8(newline) c) 123(newline)78(newline) d) 45678(newline)123(newline)
What UNIX command is used to update the modification time of a file? a) time b) modify c) cat d) touch
When mv f1 f2 is executed which file's inode is freed? a) f1 b) f2 c) new inode will be used d) implementation dependent