⟩ If we do not specify the executable file name at the compilation time in GCC, then in linux the compiler creates executable named as a) a.out b) a.exe c) x.out d) x.exe
a) a.out
a) a.out
File descriptor table indexes which kernel structure? a) struct file b) strruct fs_struct c) files_struct d) struct inode
Executing the 'cd ..' command when at the root level causes a) Error message indicating the user can't access beyond the root level b) Behavior is unix-flavor dependent c) Results in changing to the 'home' directory d) Nothing happens
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)