unix mcq question and answer

Join Our Official AiJobsAdda Telegram Channel

Unix Operating System Multiple Choice Questions with Answers:-

1. Unix OS was first developed by
a. Dennis Ritchie
b. Bjarne stroustrup
c. Ken Thompson
d. Brian Kernighan

Ans.C

2. Unix OS was first developed at
a. Microsoft corp. USA
b. AT & T Bell Labs, USA
c. IBM, USA
d. Borland International, USA

Ans.B

3. Unix is written in
a. C language
b. Ada language
c. Perl language
d. Pascal language

Ans.A

4. Unix is a
a. Single User, Single tasking OS
b. Single User, Multi-tasking OS
c. Multi-User, Multi- tasking OS
d. None

Ans.C

5. Which of the following is a command for searching a pattern in a file?
a. Find
b. b. group
c. c.look up.
d. None

Ans.B

6. Unix Command can be typed in
a. Lower case
b. Upper case
c. Both the cases
d. None

Ans.A

7. Shell Program is stored in a file called
a. Unix
b. Sh
c. Dd
d. Cc

Ans.B

8. WhicBh shell offers a command history feature
a. C shell
b. Visual shell
c. Bourne shell
d. Korn shell

Ans.C

9. The minimum number of links for any directory file are
a. 3
b. 4
c. 1
d. 2

Ans.D

10. The default value of Umask is
a. 1024
b. 4021
c. 0022
d. 1001

Ans.C

11. Binary executable required for system administration is usually placed in ________ directory.
a. Letc
b. lusr
c. ldev
d. none

Ans.A

12. All user directories are usually placed in _________ directory.
a. Letc
b. lusr
c. ldev
d. none

Ans.B

13. If there are three links for a file then the number of copies of the file would be
a. One
b. two
c. three
d. four

Ans.A

14. After typing the contents of file test created by you by giving the command cat>test you save the contents by
a. Pressing the keys ctrl-c
b. Typing save and pressing enter
c. Pressing Esc key
d. Pressing ctrl-d

Ans.D

15. The file for which we do not have write permission can be deleted using the command
a. rm-i file
b. rm-I file
c. rm-r-file
d. rm-f-file

Ans.D

16. The permission 746 can be represented as
a. rwxrwx- -x
b. rw- -w-r-x
c. rwxr-xr-x
d. rwxr- -rw–

Ans.D

17. A Sticky bit applies to a file would mean that
a. No one can remove it
b. It would stick around in memory even when its execution is over
c. Next time you login it would get executed on its own
d. None of the above

Ans.B

18. The command pwd gives
a. Present working directory
b. Password in encrypted form
c. Password in decrypted form
d. None

Ans.A

19. Which of the following is not a unix command
a. Cd
b. rm
c. pwd
d. del

Ans.D

20. The size of any block in the unix file system is
a. 512 bytes
b.1024 bytes
c. 2048 bytes
d. Any of the above

Ans.D

21) To find the block size on your file system the command is
a. Blksz
b. Szblk
c. Chksz
d. Cmchk

Ans.D

22) Each entry in inode table is of size
a. 64 kb
b. 32kb
c. 32 bytes
d. 64 bytes

Ans.D

23) The program contained in boot block, that loads kernel into memory is called
a. Disk Bootstrap program
b. Master boot program
c. Shell program
d. None of the above

Ans.A

24) The state of the file system is contained in
a. Boot block
b. A special block created by Book Block
c. Super Block
d. None of the above

Ans.C

25) Which file gets executed when we use the passwd command
a. /etc/passwd
b. /etc/pwd
c. /bin/passwd
d. /passwd

Ans.C

26) The command cal j 1997 would give the output as

a. The calendar of jan, june and july 1997
b. Only calendar of jan 1997
c. An error
d. None of the above

Ans.C

27) The output of command banner “Unix shell programming” would be
a. A banner showing ‘unix’,’shell’ and ‘programming’ words displayed in separate lines
b. A banner showing ‘unix shell’ in one single line
c. Nothing
d. A banner showing ‘unix shell programming’ in one line.

Ans.B

28) To see the last access time of various files in a file system the command is
a. Is-Iu
b. Is-I
c. Is-acc
d. Is-mt

Ans.A

29) To ascertain what are the contents of the file in your the system the best way would be
a. Do a cat command on each file and find its contents
b. Use the command cat*
c. Use the command file*
d. None of the above

Ans.C

30) Which of these is not a command of Unix related with DOS
a. Dosdir a:proj
b. Doscopy trial a:/
c. Doscp/HOME/Proj/Prg a:/
d. Dosls

Ans.B

31) Which of the following is not true

a. Sorting is done on the basics of first character of each line
b. Sort command sorts a file word by word rather than line by line
c. Sort command has s provision to do a numeric sort
d. Sort is not a filter

Ans. B

32) To change the access time of a file to 12:40 PM on 26th Jan 1997 the command would be

a. Touch –a 2601971240 file
b. Touch –a 1240260197 file
c. Touch –a 0126124097 file
d. Touch –a 9701261240 file

Ans. C

33) The command cut –f 2,8 –d”:”file I would output

a. The fields 2 to 8 from file I where delimiter between fileds is:
b. The fields 2 to 8 from file I including the delimiter : between fields
c. The columns 2 to 8 from file I with : between each column
d. None of the above

Ans. A

34) The command to search the pattern “Hi there” in file I would be

a. Grep “Hi there” file 1
b. Grep Hi there file 1
c. Grep file1
d. Grep ‘Hi there’ file 1

Ans. A

35) The command head f1 would display

a. First line of the file f1
b. Nothing
c. First 10 lines of the file f1
d. The whole file f1

Ans.C

36) After you have entered text in your file, to save and quit vi you will use

a. Esc shift ZZ
b. Shift ZZ
c. Esc:q Enter
d. None of the above

Ans. A

37) To search a pattern which starts with uni the command would be

a. :/
d. :/
d. List of all abbreviations that have been set can be seen through the command :set abbr
e. All are false

Ans.E

41) Which of following commands do not belong to multiple file editing commands
a. :n!
b. :q!
c. :rnew!
d. All the above

Ans.D

42) The difference between the commands ps –e and ps –a is
a. Ps –e gives details of every process running in memory whereas ps –a gives output for all the process that you have launched
b. Ps –e gives details of every process running in memory whereas ps –a gives details of all user processes
c. No difference , both give same output
d. None of the above

Ans.B

43) The father of all processes is
a. Root
b. Sh
c. Sched
d. Init

Ans.C

44) The process id numbers of the processes vhand,bdflush,sched and init are
a. 1,2,3 and 4
b. 2,3,0 and 1
c. 3,4,1 and 2
d. 0,1,2 and 3

Ans.B

45) Which of the following is not true regarding the command $ nohup cat *.let | nohup sort >f1 &
a. The process would die if the user logs out before the command’s execution is over
b. If the user logs out the output of sort would be dtored in a file nohup.out
c. It is optional to give nohup before sort
d. This background process is also known as a deamon process

Ans.A,D

46) Which of the following is not true regards the kill command
a. Super user can kill deamon processes
b. For sure kill the signal no is 9
c. There is no surety that the shell process will get killed by the command kill
d. Using Kill command you can kill other user’s processes too

Ans.A,D

47) Which of the following is not true
a. The at command permits you to receive messages only by mail
b. A person’s login name appears in the file at.allow if he is not allowed to use the at command
c. Both are false
d. Both are true

Ans.C

48) Which statement are true if the file which contains the following line is submitted to the crontab command
10 2 3 * 0 echo “ There is no substitute for hard work”
a.The message is echoed on the 3rd of every month at 2.10 a.m
b.The message is echoed on the 3rd of every month at 2.10 p.m
c.The message is echoed on the 3rd of every month at 2.10 a.m if it happens to be a Sunday
d. None of the above

Ans.C

49) For a person to receive messages he should have his terminal set to a parameter which will allow him receive messages.The command to set this parameter is
a.message –on
b.msg –o
c.mesg –y
d.message–y

Ans.C

50) The command that unix offers to a user to find out whether he can send messages to a particular terminal are
a.finger and who
b.finger –mesg and who –T
c.finger –I and who –t
d.finger –I and who –T

Ans.D

51) If the user has read a news item he cannot read it again because of creation of the file
a. _news_time
b. news.time
c. .news.time
d. .news_time

Ans.D

52) To read the stale news the option available is
a. news –a
b. Delete the file /usr/news
c. Delete the file _news.time
d. Delete the file .news_time

Ans.A&D

53) The message of the day is stored in a file called
a. /etc/profile
b. /etc/motv
c. .profile
d. Autoexec.bat

Ans.B

54) The incoming mail of user with the login name aa12 is stored in the file
a. /usr/spool/mail/aa12
b. /usr/aa12/mbox
c. /spool/mail/aa12
d. /usr/aa12/.mbox

Ans.A

55) .mailrc is the file
a. Which stores the incoming mail
b. Which is used to type the mail to be sent
c. Which is invoked when the mail command is executed
d. Which permits you to customize the vi environment

Ans.C

56) The escape sequence 33[4m is used to
a. underlying characters
b. mark them as bold
c. display them in reverse video
d. none of the above

Ans.B

57) Which of the following assignments is illegal
a. a=’ls’
b. b=’ls –l’
c. c=’1972’
d. d=’who | grepaal’

Ans.C

58) Which of the following assignment is illegal
a. a=’cat file’
b. a=100 b=50
c. age=25
d. all the above

Ans.C

59) A null variable a can be created using
a. a=
b. a=’’
c. a=””
d. All the above

Ans.D

60) The shell metacharacter $# represents
a. Total number of arguments supplied to the shell script
b. Total number of files in the current directory
c. Total number of users who have logged in
d. Total number of processes running in the background

Ans.A

61. When we are executing a shell script the shell acts as
a. An interpreter
b. A compiler
c. An operating system
d. None of the above

Ans.A

62. On executing a statement set -3+1
a. $1 would be -3
b. $1 would be –
c. $1 would be set
d. This command would result into an error

Ans.D

63. On executing the command Shift $v
a. The positional parameters would be shifted by the value of the variable v
b. The positional parameters would be shifted by 1
c. The positional parameters would not be shifted at all
d. This command would result into an error

Ans.A

64. Which of the following is NOT a shell keyword
a. Shift
b. Readonly
c. Unset
d. ls

Ans. D

65. To the statement read v1 v2 v3 we can supply
a. maximum 3 values
b. only 1 value
c. exactly 3 values
d. any number of values

Ans.D

66. The metacharacter $* represents
a. Number of parameters supplied at the command prompt
b. Parameters supplied at the command prompt
c. Value of the variable *
d. All files in the current directory

Ans.B

67. A shell variable cannot start with
a. An alphabet
b. A number
c. A special symbol other than an underscore
d. Both b and c above

Ans.D

68. Which of the following shows the correct hierarchy of arithmetic operations in shell
a. (),**,* or /, + or –
b. (), **, *,/,+,-
c. (),**,/,*,+,-
d. (),/,% or *,- or +

Ans.D

69. Which of the following statements is correct
a. a=expr $b + $c
b. a=’expr $b * $c’
c. a=’expr $b * ($c + $d)’
d. a=’expr $b * ( $c + $d )’

Ans.D

70. Which of the following is allowed in an arithmetic statement involving exprinstruction
a. []
b. {}
c. ()
d. None of the above

Ans.C

71. The statement z=’expr 5/2’ would store in z a value
a. 2.5
b. 3
c. 2
d. 0

Ans.C

72. The expression expr -7 % 2evaluates to
a. 1
b. -1
c. -3.5
d. 0

Ans.B

73. The expression expr -2 % 7 evaluates to
a. 2
b. -2
c. 0
d. 0.285

Ans.B

74. Hierarchy decides which operator
a. Is most important
b. Is used first
c. Is fastest
d. Operates on largest numbers

Ans.B

75. The break statement is used to exit from
a. An if statement
b. A for loop
c. A program
d. None of the above

Ans.B

76. An until loop ensures that the statement within the loop get executed
a. Only once
b. Atleast once
c. Not even once
d. None of the above

Ans.D

77. The cp command uses
a. Standard input file
b. Standard output file
c. Both input and output file
d. Neither input nor output file

Ans.D

78. Which option will be used with sort command to start sorting after the nth column of the (m+1)th field
a. –m.n
b. +m.n
c. +n.m+1
d. +(m+1).n

Ans.B

79. Which command is used to terminate a process
a. Shutdown
b. Haltsys
c. Cancel
d. Kill

Ans.D

80. The command is used to compare the files is known as
a. Comp
b. Cmp
c. Do
d. Ccp

Ans.B

81) Which of the following keys is used to move the cursor to the end of the paragraph
a. }
b. {
c. |
d. $

Ans.A

82) The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is
a. Tee
b. Tr
c. Sort
d. Grep

Ans.A

83) Which command is used to remove a directory
a. Rd
b. Rmdir
c. Dldir
d. Rdir

Ans.B

84) Which of the following keys is used to replace a dingle character with new text
a. S
b. s
c. r
d. C

Ans.B

85) Which command is used to extract a specific columns from the file
a. Cat
b. Cut
c. Grep
d. Paste

Ans.B

86) Which command sends the word count of the file infile to the newfile.
a. wcinfile>newfile
b. wcnewfile
c. wcinfile – newfile
d. wcinfile | newfile

Ans.A

87) Which command is used to remove the read permission of the file ‘note’ from both the group and others?
a. chmodgo+r note
b. chmodgo+rw note
c. chmod go-x note
d. chmod go-r, 4-x note

Ans.D

88) Which command is used to concatenate all files beginning with the string ’emp’ and followed by a non-numeric characters?
a. cat emp[!0-9]
b. more [emp][!0-9]
c. cat emp[x-z]
d. cat emp[a-z]

Ans.A

89) Which command will be used with vi editor to insert text to left of cursor?
a. s
b. S
c. a
d. i

Ans.D

90) In vi editor, forward search is performed using the command.
a. :pat
b. :pat
c. /pat
d. All of the above

Ans.D

91) Which of the following special shell variables is used to process number of the last background job?
a. $!
b. $#
c. $0
d. $*

Ans.A

92) Which option will be used with ps command to slow the entire command line of the process being run?
A. -4
B. -f
C. -1
D. -4

Ans.B

93) Which of the following command addresses all users who are currently hooked on?
A. write
B. mail
C. wall
D. mesg

Ans.C

94) Which of the following commands is used to identify the type of file by context?
A. ls
B. cat
C. file
D. more

Ans.C

95) The filed separator in cut command is specified with
A. -a option
B. -d option
C. -r option
D. -x option

Ans.B

96) Which of the following options will be used to display number of blocks used by a file?
A. -c
B. -i
C. -d
D. -s

Ans.D

97) Which option will be used with touch command to change the access time?
A. -a
B. -b
C. -t
D. -h

Ans.A

98) Which command is used to make all files and sub-directories in the directory (progs) executable by all users?
A. chmod -R a+xprogs
B. chmod -R 222 progs
C. chmod -1 a+xprogs
D. chmod -x a+xprogs

Ans.A

99) Which command is used to display and create files?
A. cat
B. vi
C. ed
D. lyrix

Ans.A

100) The second set of the three permissions (r-) indicates that
A. group has read permission only
B. other has read permission only
C. owner has read permission only
D. group has write permission only

Ans.A