⟩ Lp0 device file is used to access a) Floppy b) Cdrom c) Printer d) Tape drive
c) Printer
c) Printer
read() system call on success returns a) 0 b) -1 c) number of character d) none
namei() is a) ANSI C library function b) C library function c) System call d) kernel routine
How do you rename file "new" to file "old"? a) mv new old b) move new old c) cp new old d) rn new old
If one of the thread in multi-threaded process is blocked on an I/O, which of the following is true? a) The entire process with block if their is no kernel supported threads b) Other threads of the process will continue to execute even if there is no kernel supported threads c) It depends on specific implementatation d) All of the above
Given a code snippet below? #define PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) int main() { int fd1, fd2; umask(0); fd1 = open("file1", O_CREAT | O_RDWR, PERMS) umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); fd2 = open("file2", O_CREAT | O_RDWR, PERMS) return 0; } The newly created files file1 and file2 will have the permissions respectively a) rw-rw-rw- r--- b) r--- rw-rw-rw- c) rw-rw-rw- rw--- d) None of the above
What is stored in logfile as per below mentioned code if we execute ./a.out > logfile? int main() { int fd; close(1); fd = open("logfile",O_RDWR, 0744); write(fd, "Hello", 5); printf("Worldn"); return 0; } a) Hello b) HelloWorld c) World d) None
Code snippet (file1 size is 2024) f1 = fopen (file1, RDWR, RWX) lseek(f1,1024,SEEK_SET) write(f1,buf,10) What is offset now. a) 1024 b) 1034 c) 2034 d) 2054
Code snippets str1="45678n" str2="123n" f1 = fopen(file1,RDWR,RWX) f2 = dup(f1) 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)
For the below mentioned code int main() { int fd; fd = open("logfile", O_CREAT|O_RDWR, 0600); lseek(fd, 5, SEEK_CUR); write(fd, "Hello", 5); return 0; } What is the logfile size now if it's initially was 1024 bytes? a) 5 b) 1024 c) 1029 d) 1034
Where can I find the printer in the file structure? a) /etc b) /dev c) /lib d) /printer