143
87k

620+ Operating System Architecture Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) .

351.

A user executes the following command successfully:$ chmod +x file1.txt Which of the following is true of the output of this command?

A. he command results in adding execute permission to the user who ran this command
B. the command results in adding execute permission for the owner of the file
C. the command results in an error since the file is not an executable file
D. the command results in adding execute permission for all users (i.e., user,group & others)
Answer» D. the command results in adding execute permission for all users (i.e., user,group & others)
352.

What does chmod +t do?

A. wrong syntax
B. set effective userid for filename
C. set effective groupid for filename
D. set the sticky bit
Answer» D. set the sticky bit
353.

Which of the following umask settings doesn’t allow execute permission to be set by default on directory files

A. 222
B. 111
C. 0
D. 444
Answer» C. 0
354.

Which of the following umask settings allow execute permission to be set by default on regular files

A. 222
B. 111
C. 0
D. none of the given choices
Answer» D. none of the given choices
355.

The command chmod 4777 a.out

A. will set the suid bit of a.out
B. will set the suid bit of a.out only if the command is issued by root
C. is not a valid command
D. will set the sticky bit of a.out
Answer» A. will set the suid bit of a.out
356.

If a file is removed in Unix using ‘rm’ then

A. the file can be recovered by a normal user
B. the file cannot be recovered by a user
C. the file can be fully recovered provided the sytem is not rebooted
D. the file will be moved to /lost+found directory and can be recovered only by administrator’s
Answer» B. the file cannot be recovered by a user
357.

When mv f1 f2 is executed which file’s inode is freed?

A. f1
B. f2
C. new inode will be used
D. new inode will be used
Answer» B. f2
358.

. The file permission 764 means:

A. every one can read, group can execute only and the owner can read and write
B. every one can read and write, but owner alone can execute
C. every one can read, group including owner can write, owner alone can execute
D. every one can read and write and execute
Answer» C. every one can read, group including owner can write, owner alone can execute
359.

When you use the ln command, which of the following occurs?

A. a file is created that points to an existing file
B. a file is created that is a copy of an existing file
C. a file is moved from one location to another
D. a file is renamed
Answer» A. a file is created that points to an existing file
360.

srwxr-xrw- is a

A. internet socket file
B. unix domain socket file
C. symbolic link
D. shared file
Answer» B. unix domain socket file
361.

Binary or executable files are:

A. regular files
B. device files
C. special files
D. directory files
Answer» A. regular files
362.

The directory file contains

A. file names & file sizes
B. file names & inode numbers
C. file names & address
D. file names & permissions
Answer» B. file names & inode numbers
363.

Which directory contain device special files?

A. /etc
B. /etc/dev
C. /root/bin
D. /dev
Answer» D. /dev
364.

Which of the following is not a valid file type on Linux

A. socket
B. softlink
C. inode
D. fifo
Answer» C. inode
365.

Which of the following is not correct statement regarding file types?

A. hard links share same inode number
B. soft links cannot be created across partitions
C. socket files are unix domain sockets
D. character file is a special file
Answer» B. soft links cannot be created across partitions
366.

Which are the two types of device files?

A. character & block
B. character & socket
C. block & fifo
D. input & output
Answer» A. character & block
367.

Which is an example for character special file?

A. hard disk
B. cd-rom
C. terminal
D. memory
Answer» C. terminal
368.

Which is an example for block special file?

A. virtual terminal
B. cd-rom
C. terminal
D. serial modem
Answer» B. cd-rom
369.

All device files are stored in which directory?

A. /etc
B. /bin
C. /dev
D. usr
Answer» C. /dev
370.

Which command is used to check filesystem usage in a system?

A. mount
B. df
C. du
D. dd
Answer» B. df
371.

Which among the following allows fast file system recovery?

A. ext2
B. journaling
C. caching
D. sysfs
Answer» B. journaling
372.

Which filesystem can be used to change certain kernel parameters at runtime using sysctl command?

A. ext3
B. sysfs
C. ext4
D. procfs
Answer» D. procfs
373.

Filesystem for CDROM is:

A. ext3
B. sysfs
C. ext4
D. procfs
Answer» C. ext4
374.

Which file system has journaling capability?

A. ext2
B. ext4
C. isofs
D. procfs
Answer» B. ext4
375.

Which file contains the filesystems to be automatically mounted during boot?

A. /etc/mount
B. /etc/fstab
C. /etc/inittab
D. /etc/boot
Answer» B. /etc/fstab
376.

which to mount the file system

A. root
B. boot
C. mount-point
D. partition
Answer» C. mount-point
377.

Which command is used to mount file system read only.

A. mount –a
B. mount –v
C. mount –f
D. mount –r
Answer» D. mount –r
378.

Each process has unique

A. fd table
B. file table
C. inode table
D. data block table
Answer» A. fd table
379.

File descriptor table indexes which kernel structure?

A. struct file
B. strruct fs_struct
C. files_struct
D. struct inode
Answer» A. struct file
380.

What is the default number of files open per user process?

A. 0
B. 1
C. 2
D. 3
Answer» D. 3
381.

he file system information is stored in

A. boot block
B. super block
C. inode table
D. data block
Answer» B. super block
382.

Switch table is used by

A. device special file
B. directory file
C. fifo
D. link file.
Answer» A. device special file
383.

What is the use of fcntl function?

A. locking a file
B. reading the file descriptor flag
C. changing the file status flag
D. all the above
Answer» D. all the above
384.

Which function can be used instead of the dup2 to duplicate the file descriptor?

A. read()
B. open()
C. stat()
D. fcntl()
Answer» D. fcntl()
385.

printf() uses which system call

A. open
B. read
C. write
D. close
Answer» C. write
386.

read() system call on success returns

A. 0
B. -1
C. c)
D. none
Answer» C. c)
387.

Which system call is used to create a hard link?

A. hardlink
B. link
C. symlink
D. ln
Answer» B. link
388.

namei() is

A. ansi c library function
B. c library function
C. system call
D. kernel routine
Answer» D. kernel routine
389.

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
Answer» B. closes the stdin and copies the stdout descriptor to stdin
390.

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;
}

A. hello
B. helloworld
C. world
D. none
Answer» B. helloworld
391.

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;
},

A. 5
B. 1024
C. 1029
D. 1034
Answer» B. 1024
392.

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 abov
Answer» C. rw-rw-rw- rw——
393.

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?

A. 30 30
B. 100020 20
C. 100030 30
D. 100010 30
Answer» D. 100010 30
394.

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:

A. 12378
B. 123(newline)8(new line)
C. 123(newline)78(ne wline)
D. 45678(newline)1 23(newline)
Answer» B. 123(newline)8(new line)
395.

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
Answer» B. 1034
396.

what is file system

A. seqenceof bytes
B. sequence of bits
C. sequence of kilo bytes
D. sequence of megabytes
Answer» A. seqenceof bytes
397.

The parent directory is known as

A. root
B. bin
C. user
D. none of these
Answer» A. root
398.

user on unix system is alled as

A. unique user
B. super user
C. special user
D. all of these
Answer» B. super user
399.

the different pemissions asociated with files are

A. read
B. write
C. execute
D. all ofthese
Answer» D. all ofthese
400.

The command - in ls represents

A. accessibility of a file
B. permissin on the file
C. reead
D. execute
Answer» B. permissin on the file

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.