Operating System Architecture Set 16

On This Page

This set of Operating System Architecture Multiple Choice Questions & Answers (MCQs) focuses on Operating System Architecture Set 16

Q1 | which to mount the file system
  • root
  • boot
  • mount-point
  • partition
Q2 | Which command is used to mount file system read only.
  • mount –a
  • mount –v
  • mount –f
  • mount –r
Q3 | Each process has unique
  • fd table
  • file table
  • inode table
  • data block table
Q4 | File descriptor table indexes which kernel structure?
  • struct file
  • strruct fs_struct
  • files_struct
  • struct inode
Q5 | What is the default number of files open per user process?
  • 0
  • 1
  • 2
  • 3
Q6 | he file system information is stored in
  • boot block
  • super block
  • inode table
  • data block
Q7 | Switch table is used by
  • device special file
  • directory file
  • fifo
  • link file.
Q8 | What is the use of fcntl function?
  • locking a file
  • reading the file descriptor flag
  • changing the file status flag
  • all the above
Q9 | Which function can be used instead of the dup2 to duplicate the file descriptor?
  • read()
  • open()
  • stat()
  • fcntl()
Q10 | printf() uses which system call
  • open
  • read
  • write
  • close
Q11 | read() system call on success returns
  • 0
  • -1
  • c)
  • none
Q12 | Which system call is used to create a hard link?
  • hardlink
  • link
  • symlink
  • ln
Q13 | namei() is
  • ansi c library function
  • c library function
  • system call
  • kernel routine
Q14 | dup2(1,0)
  • closes the stdout and copies the stdin descriptor to stdout
  • closes the stdin and copies the stdout descriptor to stdin
  • will produce compilation error
  • none of the above
Q15 | What is stored in logfile as per below mentioned code if we execute ./a.out > logfile?nt main() {int fd; close(1);fd = open(“logfile”,O_RDWR, 0744); write(fd, “Hello”, 5); printf(“World\n”);return 0;}
  • hello
  • helloworld
  • world
  • none
Q16 | For the below mentioned codeint main() { int fd;fd = open(“logfile”, O_CREAT|O_RDWR, 0600);lseek(fd, 5, SEEK_CUR);write(fd, “Hello”, 5);return 0;},
  • 5
  • 1024
  • 1029
  • 1034
Q17 | 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
  • rw-rw-rw- r——–
  • r——– rw-rw-rw-
  • rw-rw-rw- rw——
  • none of the abov
Q18 | Below is the codeint 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?
  • 30 30
  • 100020 20
  • 100030 30
  • 100010 30
Q19 | ode snippets str1=”45678\n” str2=”123\n”f1 = fopen(file1,RDWR,RWX) f2 = fopen(file1,RDWR,RWX) write(f1,str1,len_str1) write(f2,str2,len_str2)o/p:
  • 12378
  • 123(newline)8(new line)
  • 123(newline)78(ne wline)
  • 45678(newline)1 23(newline)
Q20 | Code snippet (file1 size is 2024)f1 = fopen (file1, RDWR, RWX)lseek(f1,1024,SEEK_SET) write(f1,buf,10)What is offset now.
  • 1024
  • 1034
  • 2034
  • 2054
Q21 | what is file system
  • seqenceof bytes
  • sequence of bits
  • sequence of kilo bytes
  • sequence of megabytes
Q22 | The parent directory is known as
  • root
  • bin
  • user
  • none of these
Q23 | user on unix system is alled as
  • unique user
  • super user
  • special user
  • all of these
Q24 | the different pemissions asociated with files are
  • read
  • write
  • execute
  • all ofthese
Q25 | The command - in ls represents
  • accessibility of a file
  • permissin on the file
  • reead
  • execute