You are on page 1of 29

1.

What would be the current working directory at the end of the following command
sequence? $ pwd /home/user1/proj $ cd src $ cd generic $ cd . $ pwd
A. /home/user1/proj
B. /home/user1/proj/src
C. /home/user1
D. /home/user1/proj/src/generic
Answer: D

2. How do you print the lines between 5 and 10, both inclusive
A. cat filename | head | tail -6
B. cat filename | head | tail -5
C. cat filename | tail +5 | head
D. cat filename | tail -5 | head -10
Answer: A

3. Create a new file “new.txt” that is a concatenation of “file1.txt” and


“file2.txt”
A. cp file.txt file2.txt new.txt
B. cat file1.txt file2.txt > new.txt
C. mv file[12].txt new.txt
D. ls file1.txt file2.txt | new.txt
Answer: B

4. which of these is NOT a valid variable in bash


A. __ (double underscore)
B. _1var (underscore 1 var )
C. _var_ (underscore var underscore)
D. some-var (some hyphen var)
Answer: D

5. What is the return value ($?) of this code:os = Unix[$osName = UnixName] && exit
2[$osName = UnixName] && exit 3
A. 0
B. 1
C. 2
D. 3
Answer: D

6. To feed standard output of one command to standard input of another in a single


shell session
A. IO redirection can be used
B. Named pipes can be used
C. The pipe operator provided by the shell can be used
D. It cannot be done
Answer: C

7. Which of the following commands allows definition and assignment of environment


variables under bash
A. env
B. export
C. environ
D. setenviron
Answer: A

8. While executing a command, the shell


A. Executes it in the same process (as shell)
B. Creates a child shell to execute it
C. Loads a special program to take care of the execution
D. None of the above
Answer: B

9. Which variable contains current shell process id


A. $*
B. $?
C. $$
D. $!
Answer: C

10. Which command is used to debug a shell script program


A. set
B. set -x
C. debug
D. db
Answer: B

11. For every successful login, which script will be executed?


A. /etc/inittab
B. /etc/profile
C. /etc/login
D. /etc/init
Answer: B

12. Hidden files are


A. Those whose ‘read’ bit is set to ‘h’
B. Permitted for (can be accessed) only superusers
C. Files that begin with a ‘.’
D. Files that cannot be opened by ordinary user for writing
Answer: C

13. Shell is ?
A. Command Interpreter
B. Interface between Kernel and Hardware
C. Interface between user and applications
D. Command Compiler
Answer: A

14. If a file with execute permissions set, but with unknown file format is
executed
A. The file is passed to /bin/sh
B. The system returns an error
C. The current shell will try to execute it
D. None of the mentioned
Answer: C

15. Which of the following is true?


A. Shell is a process and can be started by superuser only
B. Shell is a built-in Kernel functionality
C. Shell is a wrapper for all the commands and utilities
D. None of the mentioned
Answer: C

16. Which is true with regards to the shell prompt


A. It can be accidentally erased with backspace
B. The prompt cannot be modified
C. The prompt can be customized (modified)
D. None of the mentioned
Answer: C
17. What is a shell in UNIX?
A. a program through which users can issue commands to UNIX
B. a window management system
C. the login screen
D. the thing that rides on the back of a turtle in UNIX
Answer: A

18. Which of the following represents an absolute path?


A. ../home/file.txt
B. bin/cat
C. cs2204/
D. /usr/bin/cat
Answer: D

19. The user bhojas logged in and performed the following sequence of command. What
will be the output of the last command?$ cd project/module1$ pwd
A. /home/bhojas/project/module1
B. /home/project/module1
C. /usr/bhojas/project/module1
D. project/module1
Answer: A

20. BASH shell stands for?


A. Bourne-again Shell
B. Basic Access Shell
C. Basic to Advanced Shell
D. Big & Advanced Shell
Answer: A

21. The redirection 2> abc implies


A. Write file 2 to file abc
B. Write standard output to abc
C. Write standard error to abc
D. none of the mentioned
Answer: C

22. cmd 2>&1 > abc will


A. Write file2 to file1
B. Write standard output and standard error to abc
C. Write standard error to abc
D. Write standard output to abc & standard error to monitor
Answer: D

23. cmd > abc 2>&1 will


A. Write file2 to file1
B. Write standard output and standard error to abc
C. Write standard error to abc
D. Write standard output to abc & standard error to monitor
Answer: B

24. Which of these is the correct method for appending “foo” in /tmp/bar file?
A. echo foo > /tmp/bar
B. echo foo >> /tmp/bar
C. echo foo | /tmp/var
D. /tmp/bar < echo foo
Answer: B

25. Syntax to suppress the display of command error to monitor?


A. command > &2
B. command 2> &1
C. command 2> &2
D. command 2> /dev/null
Answer: D

26. The following commands gives the output like this#cat file1 file2#cat: file1:
No such file or directoryhelloIf we execute the command “cat file1 file2 1>2 2>&1”
the output would be
A. cat: file1: No such file or directory hello
B. No output is displayed
C. Cat: 1>2: No such file or directory
D. hello
Answer: B

27. cat < file1 >> file2 | file3


A. file1 content will be appended to file2 and finally stored in file3
B. file1 content will be appended to file2 and file3 will be ignored
C. file2 and file3 will have same content
D. syntax error
Answer: D

28. Executing cat /etc/password > /dev/sda as superuser will


A. Write data into a regular file called /dev/sda
B. Write data to the physical device sda
C. Create a temporary file /dev/sda and write data to it
D. None of the above
Answer: B

29. From where would the read statement read if the following statements were
executed?exec < file1exec < file2exec < file3read line
A. It would read all the files
B. It would not read any files
C. It would read all the files in reverse order
D. It would read only file3
Answer: B

30. The $ variables in a shell script context designates


A. The runtime of the script
B. Number of command line arguments
C. PID of the shell running the script
D. The exit status of the shell script
Answer: C

31. Which variable is used to display number of arguments specified in command line
A. $0
B. $#
C. $*
D. $?
Answer: B

32. Which variable contains last background job process id


A. $*
B. $?
C. $$
D. $!
Answer: D

33. Which command can be used to test various file attributes


A. if
B. file
C. test
D. type
Answer: C

34. What command would send the output of cmd1 to the input of cmd2?
A. cmd1 | cmd2
B. cmd1 || cmd2
C. cmd1 && cmd2
D. cmd1 ; cmd2
Answer: A

35. What is the output of the following command for bash shell:echo linux $0
A. linux echo
B. linux linux
C. linux bash
D. linux
Answer: C

36. Which variable will display the list of the positional parameters?
A. $#
B. $*
C. $?
D. $$
Answer: B

37. To feed standard output of one command to standard input of another in a single
shell session
A. IO redirection can be used
B. Named pipes can be used
C. The pipe operator provided by the shell can be used
D. It cannot be done
Answer: C

38. Which of the following commands allows definition and assignment of environment
variables under bash
A. env
B. export
C. environ
D. setenviron
Answer: A

39. While executing a command, the shell


A. Executes it in the same process (as shell)
B. Creates a child shell to execute it
C. Loads a special program to take care of the execution
D. None of the above
Answer: B

40. For every successful login, which script will be executed?


A. /etc/inittab
B. /etc/profile
C. /etc/login
D. /etc/init
Answer: B

41. Hidden files are


A. Those whose ‘read’ bit is set to ‘h’
B. Permitted for (can be accessed) only superusers
C. Files that begin with a ‘.’
D. Files that cannot be opened by ordinary user for writing
Answer: C

42. Which is true with regards to the shell prompt


A. It can be accidentally erased with backspace
B. The prompt cannot be modified
C. The prompt can be customized (modified)
D. None of the mentioned
Answer: C

43. What is a shell in UNIX?


A. a program through which users can issue commands to UNIX
B. a window management system
C. the login screen
D. the thing that rides on the back of a turtle in UNIX
Answer: A

44. Which of the following represents an absolute path?


A. ../home/file.txt
B. bin/cat
C. cs2204/
D. /usr/bin/cat
Answer: D

45. The user bhojas logged in and performed the following sequence of command. What
will be the output of the last command?$ cd project/module1$ pwd
A. /home/bhojas/project/module1
B. /home/project/module1
C. /usr/bhojas/project/module1
D. project/module1
Answer: A

46. BASH shell stands for?


A. Bourne-again Shell
B. Basic Access Shell
C. Basic to Advanced Shell
D. Big & Advanced Shell
Answer: A

47. Which of the following files will not be displayed by the command cat re* ?
A. reminder
B. receipt
C. Receipt
D. recipe-cake
Answer: C

48. The redirection 2> abc implies


A. Write file 2 to file abc
B. Write standard output to abc
C. Write standard error to abc
D. none of the mentioned
Answer: C

49. Which of these is the correct method for appending “foo” in /tmp/bar file?
A. echo foo > /tmp/bar
B. echo foo >> /tmp/bar
C. echo foo | /tmp/var
D. /tmp/bar < echo foo
Answer: B

50. Syntax to suppress the display of command error to monitor?


A. command > &2
B. command 2> &1
C. command 2> &2
D. command 2> /dev/null
Answer: D

51. The following commands gives the output like this#cat file1 file2#cat: file1:
No such file or directoryhelloIf we execute the command “cat file1 file2 1>2 2>&1”
the output would be
A. cat: file1: No such file or directory hello
B. No output is displayed
C. Cat: 1>2: No such file or directory
D. hello
Answer: B

52. cat < file1 >> file2 | file3


A. file1 content will be appended to file2 and finally stored in file3
B. file1 content will be appended to file2 and file3 will be ignored
C. file2 and file3 will have same content
D. syntax error
Answer: D

53. Executing cat /etc/password > /dev/sda as superuser will


A. Write data into a regular file called /dev/sda
B. Write data to the physical device sda
C. Create a temporary file /dev/sda and write data to it
D. None of the above
Answer: B

54. From where would the read statement read if the following statements were
executed?exec < file1exec < file2exec < file3read line
A. It would read all the files
B. It would not read any files
C. It would read all the files in reverse order
D. It would read only file3
Answer: B

55. The $ variables in a shell script context designates


A. The runtime of the script
B. Number of command line arguments
C. PID of the shell running the script
D. The exit status of the shell script
Answer: C

56. Which command can be used to test various file attributes


A. if
B. file
C. test
D. type
Answer: C

57. Which of the following file set in the current directory are identified by the
regular expression a?b*
A. afcc, aabb
B. aabb, axbc
C. abbb, abxy
D. abcd, axbb
Answer: B

58. What command would send the output of cmd1 to the input of cmd2?
A. cmd1 | cmd2
B. cmd1 || cmd2
C. cmd1 && cmd2
D. cmd1 ; cmd2
Answer: A

59. What is the output of the following command for bash shell:echo linux $0
A. linux echo
B. linux linux
C. linux bash
D. linux
Answer: C

60. Which option of grep displays the line number as well?


A. -v
B. -l
C. -n
D. -E
Answer: C

61. How can you search for blank line in a file?


A. $ grep “ “ file
B. $ grep “^$” file
C. $ grep [“ “] file
D. $ grep [^$] file
Answer: B

62. Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a
directory, which files match with the pattern file[ABC]?
A. fileA, fileB and fileABC
B. fileABC
C. fileA and fileB
D. fileAB, fileBC and fileABC
Answer: C

63. What will be printed for the command below?$ grep –c “^echo” abc
A. The count of lines that do not contain the pattern echo in file abc
B. The count of lines which begin with the pattern echo in file abc
C. The count of lines that ends with the pattern echo in file abc
D. None of the above
Answer: B

64. Which one is used to select only one copy of the repeated lines?
A. uniq -u
B. uniq -d
C. uniq -c
D. uniq –I
Answer: A

65. Indicate the right option to search for BOB, Bob, BOb or BoB?
A. grep –i Bob files
B. grep ‘B[oO][bB]’ files
C. grep ‘[BOB]’ files
D. grep -v ‘Bob’ files
Answer: B
66. Indicate the right option to search for anything not a letter or number
A. grep ‘^[a-zA-Z0-9]’
B. grep ‘[^a-zA-Z0-9]’
C. grep ‘[a-zA-Z0-9]’
D. None of the above
Answer: B

67. How do you remove duplicate lines from the file foo using uniq?
A. sort foo | uniq –u
B. sort -u foo | uniq -d
C. sort foo | uniq –c
D. sort foo | uniq –I
Answer: A

68. One of the entry of /etc/passwd file is shown


below:user1:x:1111:2222:Sanfoundry:/home/user1:/bin/bashWhich among the following
will print userid and home dir in the following pattern “user1:/home/user1”
A. awk `print $1 “:” $6` /etc/passwd
B. awk `print $1 “:” $7` /etc/passwd
C. awk `print $2 “:” $6` /etc/passwd
D. awk `print $2 “:” $7` /etc/passwd
Answer: A

69. who | cut –d ” ” -f1what is the ouput if the who command displays like
thisuser1 tty 0 1234
A. user1
B. user1 tty 0 1234
C. tty
D. tty 0 1234
Answer: A

70. What is the command that can print lines of first file matching with second
file?
A. printline
B. cmp
C. com
D. comm
Answer: D

71. When the return value of any function is not specified within the function,
what function returns?
A. nothing
B. exit status of the last command executed
C. 0
D. none of the mentioned
Answer: B

72. Parameters can be passed to a function


A. by using the parameter variables $1, $2, $3…….
B. by using the environment variables
C. both (a) and (b)
D. none of the mentioned
Answer: A

73. Which of the following command provides the list of the functions defined in
the login session?
A. declare -f
B. declare -F
C. both (a) and (b)
D. none of the mentioned
Answer: C

74. The keyword ‘local’ is used


A. to define a variable within a function for its local scope
B. to redefine any global variable
C. this is not a valid keyword
D. none of the mentioned
Answer: A

75. Functions improves the shell’s programmability significantly, because


A. when we invoke a function, it is already in the shell’s memory, therefore a
function runs faster than seperate scripts
B. function provides a piece of code for repetative tasks
C. both (a) and (b)
D. none of the mentioned
Answer: C

76. Which command reads user input from the terminal and assign this value to a
variable name?
A. read
B. get
C. declare
D. set
Answer: A

77. Which one of the following statement is true about variables in shell?
A. variables do not require declaration before assigning value to them
B. variables are case sensitive
C. to extract the contents of a variable, we have to provide the variable a
preceding $
D. all of the mentioned
Answer: D

78. Which one of the following is not a valid shell variable?


A. _san
B. san_2
C. _san_2
D. 2_san
Answer: D

79. To redefine a variable, it can be removed from the list of variables by using
the command
A. unset
B. delete
C. remove
D. clear
Answer: A

80. fc stands for


A. find command
B. fix command
C. both (a) and (b)
D. none of the mentioned
Answer: C

81. Which command is used to reexecute the previous command?


A. !!
B. !cat
C. !3
D. !$
Answer: A

82. Which one of the following is not correct about job control in bash shell?
A. it is the ability to stop and resume any process running in shell at a later
point
B. user employs this facility via an interactive interface supplied by the kernel’s
terminal driver and bash
C. it is the ability to create any process
D. none of the mentioned
Answer: C

83. Which command allows to view the current jobs being handled by the shell?
A. jobs
B. view
C. show
D. none of the mentioned
Answer: A

84. What is job number?


A. same as PID
B. a unique number, assigned to each job in shell
C. both (a) and (b)
D. none of the mentioned
Answer: B

85. Ctrl-Z key combination


A. generates a SIGINT signal
B. stops the process running in the shell
C. kills the process running in the shell
D. both (a) and (c)
Answer: B

86. Which command brings a background job into the foreground?


A. fg
B. bg
C. jobs %1
D. none of the mentioned
Answer: A

87. ‘kill %s’ command will


A. terminate the job whose command line starts with s
B. terminate the last job
C. terminate the first job
D. none of the mentioned
Answer: A

88. ‘stty tostop’ command will


A. stop all jobs running in the shell
B. stop background jobs if they try to send output to the terminal
C. this is not a valid command
D. none of the mentioned
Answer: B

89. Which command terminates a running process by name of the process?


A. kill
B. pkill
C. killall
D. none of the mentioned
Answer: C

90. Which command sets up shorthand for command or command line?


A. set
B. alias
C. new
D. echo
Answer: B

91. What is the function of bind command in bash shell?


A. defining new macros
B. defining new key bindings for existing commands
C. dumping the installed key bindings
D. all of the mentioned
Answer: D

92. The command ‘compgen -c’ shows


A. all variable names
B. all system wide aliases
C. full list of all commands
D. none of the mentioned
Answer: C

93. Which statement resumes the next iteration of a for, while, select, or untill
loop?
A. continue
B. break
C. complete
D. command
Answer: A

94. Which command prints the directory stack?


A. cd
B. dirs
C. popd
D. pushd
Answer: B

95. The command ‘disown -r’


A. removes all jobs
B. removes all running jobs
C. marks jobs to not receive SIGHUP when bash exits
D. marks all jobs
Answer: B

96. The command ‘enable -n ‘


A. enables the specified built-in command
B. disables the specified built-in command
C. print the status of the command
D. none of the mentioned
Answer: B

97. Which command can create environment variable?


A. export
B. set
C. read
D. none of the mentioned
Answer: A

98. Which command concatenate the specified argument into a single command, then
execute the command?
A. fc
B. eval
C. exec
D. getopts
Answer: B

99. The command ‘hash’


A. manages a internal hash table
B. find and remember the full path name of the specified command
C. displays used command names and the number of hits
D. all of the mentioned
Answer: D

100. The ‘logout’ built in command is used to


A. shutdown the computer
B. logoff of the computer
C. logout the current user
D. to exit the current shell
Answer: D

101. The command ‘umask -S’


A. prints the current mask using symbolic notation
B. prints the current mask using octal numbers
C. sets the mask to 000
D. sets the mask to 777
Answer: A

102. The ‘mapfile’ command


A. reads lines of standard input and assigns each to the element of an indexed
array
B. reads lines of standard output file
C. reads lines of standard error file
D. none of the mentioned
Answer: A

103. Which option of the kill command sends the given signal name to the specified
process?
A. -l
B. -n
C. -s
D. -a
Answer: C

104. Which command removes a directory from directory stack?


A. dirs
B. popd
C. pushd
D. rm
Answer: B

105. Which command puts a script to sleep untill a signal is recieved?


A. sleep
B. suspend
C. disown
D. break
Answer: B

106. The command ‘ulimit’


A. set a limit on specified resource for system users
B. set/show process resource limit
C. both (a) and (b)
D. none of the mentioned
Answer: C

107. Which command identifies the resource of a command?


A. type
B. typeset
C. select
D. source
Answer: A

108. Which command wait for the specified process to complete and return the exit
status?
A. sleep
B. wait
C. delay
D. stop
Answer: B

109. Which command prints the accumulated user and system times for processes run
from the shell?
A. time
B. times
C. both (a) and (b)
D. none of the mentioned
Answer: B

110. Which command runs the shell built-in command ‘command’ with the given
argument?
A. builtin
B. caller
C. there is no command present for this purpose
D. none of the mentioned
Answer: A

111. Which option of the command ‘cd’ use the actual filesystem path for cd.. and
the value of pwd?
A. -l
B. -L
C. -p
D. -P
Answer: D

112. Which command generates possible completions for string according to the and
write it to standard output?
A. compgen
B. complete
C. continue
D. none of the mentioned
Answer: A

113. Which command executes ‘command’ in place of the current process instead of
creating a new process?
A. exec
B. command
C. trap
D. none of the mentioned
Answer: A

114. Which one of the following statement is not true?


A. vim editor is the improved version of vi editor
B. vi editor commands are not case sensitive
C. vi editor has two modes of operation: command mode and insert mode
D. vi stands for visual editor
Answer: B

115. Which command is used to close the vi editor?


A. q
B. wq
C. both (a) and (b)
D. none of the mentioned
Answer: C

116. Which vi editor command copies the current line of the file?
A. yy
B. yw
C. yc
D. none of the mentioned
Answer: A

117. Which command is used to delete the character before the cursor location in vi
editor?
A. X
B. x
C. D
D. d
Answer: A

118. Which command searches the string in file opened in vi editor?


A. / or ?
B. f or F
C. t or T
D. none of the mentioned
Answer: A

119. In vi editor, which command reads the content of another file?


A. read
B. r
C. ex
D. none of the mentioned
Answer: C

120. Which command shows all the abbreviations in vi editor?


A. ab
B. abb
C. show
D. none of the mentioned
Answer: A

121. Which command sets the number for all lines?


A. :set li
B. :set ln
C. :set nu
D. :set nl
Answer: C

122. What is sed?


A. a non-interactive stream editor
B. an IDE
C. a hex editor
D. none of the mentioned
Answer: A

123. Sed maintains the hold space (a buffer) to


A. copy the each line of input
B. save the data for later retrieval
C. both (a) and (b)
D. none of the mentioned
Answer: B

124. If any sed command does not specify any address then the command is applied to
A. each input line
B. none of the input line
C. last input line
D. none of the mentioned
Answer: A

125. If no file is specified in sed command then


A. sed command will not work
B. sed reads from standard input
C. sed reads the data already present in buffer
D. it is necessary to provide the filename
Answer: B

126. Which sed command deletes the specified address range


A. [address range]/s
B. [address range]/p
C. [address range]/d
D. [address range]/y
Answer: C

127. Which command is used to replace word ‘cat’ (already present in the file) with
‘mouse’ at all places in a file ‘old.txt’ and save the result in a new file
‘new.txt’?
A. sed ‘s/cat/mouce/g’ old.txt > new.txt
B. sed ‘s/cat/mouse’ old.txt new.txt
C. sed ‘/s/cat/mouse/g’ old.txt new.txt
D. sed ‘/s/cat/mouse’ old.txt > new.txt
Answer: A

128. Which command will delete all the blank lines in file old.txt?
A. sed ‘/d’ old.txt
B. sed ‘/^/d’ old.txt
C. sed ‘/^$/d’ old.txt
D. sed ‘/^*/d’ old.txt
Answer: C

129. The command “sed -n ‘/sanfoundry/p’ old.txt” will


A. print the lines containing the word ‘sanfoundry’ in file old.txt
B. delete the lines containing the word ‘sanfoundry’ in file old.txt
C. will generate an error message
D. none of the mentioned
Answer: A

130. Which option is used by sed to specify that the following string is an
instruction or set of instructions?
A. -n
B. -e
C. -f
D. -i
Answer: A

131. Which one of the following is not true?


A. nawk is the new version of awk
B. gawk is the GNU version of awk
C. linux users have the gawk
D. nawk does not provide the additional capabilities in comparison of awk
Answer: D

132. An awk program can be run by


A. including the program in the command that runs awk
B. putting it into a file and run with a command
C. running an executable awk script
D. all of the mentioned
Answer: D

133. Which one of the following is not true?


A. in typical awk program, all input is read either from standard input or
specified files
B. awk language divides its input into records and fields
C. awk reads an input record and the record is automatically seperated by the
interpreter into pieces called “fields”
D. the number of fields need to be a constant
Answer: D

134. What is the meaning of $ sign in awk programming?


A. the word following is the name of variable
B. we are refering to a field or column in the current line
C. $ sign is used for comment
D. none of the mentioned
Answer: B

135. In awk program, the statement “print” with no items


A. is equivalent to “print $0”
B. prints the entire current record
C. both (a) and (b)
D. none of the mentioned
Answer: C

136. The print and printf statements can be told to send their output to other
place except standard output, is called
A. redirection
B. redistribution
C. reinsertion
D. none of the mentioned
Answer: A

137. The command “awk print $1 san.txt” will


A. print the first line of file san.txt
B. print the first field of every line in san.txt
C. generate syntax error
D. none of the mentioned
Answer: B

138. What is the output of the command awk ‘BEGIN printf “%c”,65’
A. A
B. 65
C. syntax error
D. none of the mentioned
Answer: A

139. Which one of the following statement is not true about the format-control
letters for printf statement in awk program?
A. “c” prints a number as an ASCII character
B. “d” prints a decimal integer
C. “h” prints an unsigned hexadecimal integer
D. “o” prints an unsigned octal integer
Answer: C

140. What is expression in awk programming?


A. expression evaluates a value to print, test or pass to a function
B. expression assigns a new value to a variable or field
C. both (a) and (b)
D. none of the mentioned
Answer: C

141. Which one of the following is not true?


A. there are 3 types of constant expressions: numeric, string and regular
B. arithmetic operators are used to evaluate expressions
C. assignment expression is an expression that stores a value into a variable
D. comparison expressions does not compare strings for relationship
Answer: D

142. All numeric values are represented within awk in


A. double precision floating point
B. integer
C. exponential notation
D. fixed point
Answer: A

143. Concatenation is performed by


A. writing expressions next to one another, with no operator
B. conditional operator
C. relational operator
D. matching operator
Answer: A

144. The comparison expression “x ~ y” will true if


A. x is not equal to y
B. the string x does not match the regular expression denoted by y
C. the string x matches the regular expression denoted by y
D. none of the mentioned
Answer: C

145. Which statement skips over the rest of the loop body, causing the next cycle
around the loop to begin immediately?
A. continue
B. break
C. next
D. none of the mentioned
Answer: A

146. Which statement instructs gawk to stop processing the current data file?
A. next
B. nextfile
C. exit
D. exitfile
Answer: B

147. The command “awk ‘if (“9?>”10”) print “sanfoundry” else print “linux”'”
A. will print “sanfoundry”
B. will print “linux”
C. will generate syntax error
D. none of the mentioned
Answer: C

148. In awk, the built-in variable FS is


A. input field seperator
B. output field seperator
C. record seperator
D. subscript seperator
Answer: A

149. Wht is FNR?


A. FNR is the current record number in the current file
B. FNR is the number of fields in the current input record
C. FNR is an array contains the value of environment
D. none of the mentioned
Answer: A

150. RSTART is set by invoking the


A. match function
B. index function
C. asort function
D. split function
Answer: A

151. Which one of the following is used by awk to control the conversion of numbers
to string?
A. RS
B. OFMT
C. SUBSEP
D. RSTART
Answer: B

152. In awk program, the name of the array cannot be same with the
A. name of variable
B. value of the array element
C. both (a) and (b)
D. none of the mentioned
Answer: A

153. In awk, the built-in variable FS is


A. input field seperator
B. output field seperator
C. record seperator
D. subscript seperator
Answer: A
154. RSTART is set by invoking the
A. match function
B. index function
C. asort function
D. split function
Answer: A

155. Which one of the following is used by awk to control the conversion of numbers
to string?
A. RS
B. OFMT
C. SUBSEP
D. RSTART
Answer: B

156. In awk program, the name of the array can not be same with the
A. name of variable
B. value of the array element
C. both (a) and (b)
D. none of the mentioned
Answer: A

157. Operating system kernel must be located in


A. /
B. /boot
C. either in / or in /boot
D. none of the mentioned
Answer: C

158. Which one of the following is a mount point for a temporarily mounted
filesystem?
A. /mnt directory
B. /media directory
C. /dev directory
D. none of the mentioned
Answer: A

159. What is /root?


A. root filesystem
B. home directory of the root user
C. the directory which contains all the directories of the filesystem
D. none of the mentioned
Answer: B

160. System binaries are stored in


A. /sbin directory
B. /usr/sbin directory
C. /usr/local/sbin directory
D. all of the mentioned
Answer: D

161. The /dev directory contains the


A. device drivers
B. device files
C. kernel modules of device drivers
D. none of the mentioned
Answer: B

162. The contents of root filesystem is responsible to


A. boot the system
B. recover the system
C. repair the system
D. all of the mentioned
Answer: D

163. Static files of the bootloader are installed in


A. /boot directory
B. /root directory
C. /bin directory
D. /sbin directory
Answer: A

164. Linux filesystem contains mainly


A. ordinary files
B. device files
C. directory files
D. all of the mentioned
Answer: D

165. In linux filesystem, the passwords of different users are stored in


A. /etc/passwd file
B. /bin/passwd file
C. /etc/shadow file
D. /bin/shadow file
Answer: C

166. When we install a new package in linux system, then


A. all the files of the packages are installed in a single directory
B. different files are installed at different locations of the file system
C. package works just after extraction, installation is not required
D. none of the mentioned
Answer: B

167. Host specific configuration files are installed in


A. /etc directory
B. /lib directory
C. /root directory
D. /bin directory
Answer: A

168. The directory /media is the


A. mount point for removable media
B. mount point for filesystem
C. both (a) and (b)
D. none of the mentioned
Answer: A

169. What is /bin/sh ?


A. bourne shell
B. hard or symbolic link to the real shell command
C. bash shell
D. both (b) and (c)
Answer: B

170. The /boot directory stores the data that is used


A. before the kernel begins executing user mode programs
B. after the kernel begins executing user mode programs
C. before the bootloader is loaded in the RAM
D. none of the mentioned
Answer: A

171. Which one of the directory does not contain binary files?
A. /bin
B. /sbin
C. /etc
D. none of the mentioned
Answer: C

172. Kernel modules are present in


A. /lib directory
B. /root directory
C. /boot directory
D. none of the mentioned
Answer: A

173. The directory /opt is reserved for


A. installation of add-on application software packages
B. optional booting files
C. optional user specific files
D. none of the mentioned
Answer: A

174. The directory /srv contains


A. site-specific data which is served by the system
B. all the system files
C. all the service files provided by the specific user
D. none of the mentioned
Answer: A

175. Any file or directory present in the ______ directory may not be reserved
between the invocation of the program.
A. /var
B. /tmp
C. /etc
D. all of the mentioned
Answer: B

176. Which one of the following is not true about proc filesystem?
A. proc filesystem is a pseudo-filesystem
B. proc filesystem is used as an interface to kernel data structures
C. some files in proc filesystem allow kernel variables to be changed
D. none of the mentioned
Answer: D

177. Proc filesystem provides the information about


A. processes
B. processor
C. proxy server
D. none of the mentioned
Answer: A

178. The /proc directory contains


A. numerical sub-directory for each running process
B. sub-directories for installed buses
C. a text listing of filesystems which are supported by the kernel
D. all of the mentioned
Answer: D
179. The file /proc/[PID]/cgroups
A. describes control groups to which the process belongs
B. contains the information about all groups of the system
C. provides the information about the group which has generated the process
D. none of the mentioned
Answer: A

180. The file /proc/[PID]/cmdline holds the complete command line for the process,
unless the process is a
A. child process
B. zombie process
C. orphan process
D. none of the mentioned
Answer: B

181. What is /proc/[PID]/cwd?


A. symbolic link to current directory of the process
B. regular file containing the information about the current status of the process
C. directory containing various sub-directories
D. none of the mentioned
Answer: A

182. Which one of the following file contains the environment for the process?
A. /proc/[PID]/environ
B. /proc/[PID]/env
C. /proc/[PID]/path
D. none of the mentioned
Answer: A

183. The entry for each file opened by the process is present in
A. /proc/[PID]/fd
B. /proc/[PID]/file
C. /proc/[PID]/maps
D. none of the mentioned
Answer: A

184. The file /proc/[PID]/limits displays the ______ for each of the process’s
resource limits.
A. hard limit
B. soft limit
C. units of measurement
D. all of the mentioned
Answer: D

185. The file /proc/[PID]/maps contains the


A. currently mapped memory regions
B. available memory regions
C. memory regions which are free to map
D. none of the mentioned
Answer: A

186. What is /proc/[PID]/root?


A. symbolic link that points to the process’s root directory
B. regular file which holds all the PID of the system
C. root directory
D. does not exists in the proc filesystem
Answer: A
187. “ps” command uses the file _____ to provide the information.
A. /proc/[PID]/stat
B. /proc/[PID]/smaps
C. /proc/[PID]/oom_score_adj
D. /proc/[PID]/oom_score
Answer: A

188. Which one of the following is not correct?


A. proc filesystem does not contain any directory for thread in the process
B. in multithread process thread details will not be available if the main thread
is already terminated
C. both (a) and (b)
D. none of the mentioned
Answer: A

189. Proc filesystem does not contains


A. sub-directories for installed buses
B. device files
C. list of registered DMA
D. none of the mentioned
Answer: B

190. The file /proc/devices is the


A. text listing of major numbers
B. text listing of device groups
C. both (a) and (b)
D. none of the mentioned
Answer: C

191. The file /proc/cpuinfo is a collection of


A. cpu items
B. architecture independent items
C. both (a) and (b)
D. none of the mentioned
Answer: A

192. The proc filesystem records the number of interrupts


A. per CPU only
B. per IO device only
C. per CPU per IO device
D. none of the mentioned
Answer: C

193. Which file of the proc filesystem can be used instead of “syslog” system call
to read kernel messages?
A. /proc/kmsg
B. /proc/moudle/kmsg
C. /proc/module/msg
D. /proc/msg
Answer: A

194. /proc/partitions contains


A. major number of each partition
B. minor number of each partition
C. number of block and partition name
D. all of the mentioned
Answer: D

195. Which one of the following operating system does not supports proc filesystem?
A. IBM AIX
B. QNX
C. Solaries
D. none of the mentioned
Answer: D

196. Obtaining of the PID can be done by the utility


A. pgrep
B. pidof
C. ps
D. all of the mentioned
Answer: D

197. Which one of the following contains various bits of information about the
state of power management?
A. /proc/acpi
B. /proc/apm
C. both (a) and (b)
D. none of the mentioned
Answer: C

198. Which file contains the boot options passed to the kernel?
A. /proc/cmdline
B. /proc/root
C. /proc/boot
D. none of the mentioned
Answer: C

199. Which one of the following is a symlink to the root path as seen by the
process?
A. /proc/[PID]/root
B. /proc/[PID]/path
C. both (a) and (b)
D. none of the mentioned
Answer: A

200. The directory /proc/[PID]/tasks contains


A. hard links to any task that have been started by this process
B. files that containing tasks that have been started by this process
C. sub-direcories of various tasks
D. none of the mentioned
Answer: A

201. The list of available frame buffers are stored in


A. /proc/[PID]/fb
B. /proc/fb
C. /proc/etc/fb
D. none of the mentioned
Answer: B

202. The buddy algorithm handles the


A. memory fragmentation
B. DHCP server
C. routing
D. none of the mentioned
Answer: A

203. The file /proc/swaps contains the


A. list of active swap partitions
B. sizes of the swap partitions
C. priorities of the swap partitions
D. all of the mentioned
Answer: D

204. /proc/tty contains the information about


A. current terminal
B. all terminals
C. both (a) and (b)
D. none of the mentioned
Answer: A

205. The command “cd /proc/10/cwd” provides the


A. current working directory of process having PID 10
B. current status of the process having PID 10
C. current version of the filesystem
D. none of the mentioned
Answer: A

206. Which one of the following command will print the environement of process 1?
A. cat /proc/1/environ
B. cat /proc/bin/1/env
C. cat /proc/1/var/env
D. none of the mentioned
Answer: A

207. Most files and directories within /proc are 0 bytes in size because
A. proc filesystem exists only as a reflection of the in-memory kernel data
structure
B. these files contains very only one or two instructions
C. both(a) and (b)
D. none of the mentioned
Answer: A

208. Accessing the file /proc/meminfo gives the different result each time because
A. memory usages is always fluctuating
B. a new process id is assigned
C. logical address is different from the physical address
D. none of the mentioned
Answer: A

209. The files of /proc directory are


A. stored in secondary memory
B. generated by the kernel
C. both (a) and (b)
D. none of the mentioned
Answer: B

210. The directory /proc/net contains information about


A. different network system compiled into the system
B. IP address of the system
C. MAC address of the system
D. none of the mentioned
Answer: A

211. The command “echo www.sanfoundry.com > /proc/sys/kernel/hostname” will


A. change the hostname
B. print “www.sanfoundry.com”
C. do nothing
D. none of the mentioned
Answer: A

212. Which file is used primarily for diagnosing memory fragmentation issues ?
A. /proc/buddyinfo
B. /proc/meminfo
C. /proc/apm
D. none of the mentioned
Answer: A

213. Which file shows the parameter passed to kernel at the time of starting?
A. /proc/apm
B. /proc/cmdline
C. both (a) and (b)
D. none of the mentioned
Answer: B

214. The file /proc/execdomains lists the


A. execution domains currently supported by the linux kernel
B. all domains of all processes
C. registered ISA DMA channel in use
D. none of the mentioned
Answer: A

215. The file /proc/kcore displays a size of


A. RAM
B. RAM plus 4 KB
C. RAM plus 8 KB
D. none of the mentioned
Answer: B

216. The file /proc/locks displays the file currently locked by the
A. kernel
B. user
C. superuser
D. none of the mentioned
Answer: A

217. The file /proc version shows the version of ______ used in the system.
A. kernel
B. gcc
C. both (a) and (b)
D. none of the mentioned
Answer: C

218. What is /proc/self ?


A. a directory
B. link to the currently running process
C. it allows a process to look itself without having to know its process ID
D. all of the mentioned
Answer: D

219. The /sbin/sysctl command is used to


A. view kernel settings in the /proc/sys/ directory
B. set kernel settings in the /proc/sys/ directory
C. automate kernel settings in the /proc/sys/ directory
D. all of the mentioned
Answer: D
220. What is makefile?
A. makefile describes to the make command that how to compile the program
B. makefile contains various statements related with the compilation of target
C. both (a) and (b)
D. none of the mentioned
Answer: A

221. As we type “make” command on the terminal


A. make reads the makefile in the current directory
B. make reads the makefile in the parent directory
C. make reads the makefile in the predefined environment variable
D. none of the mentioned
Answer: A

222. The makefile starts executing from


A. first target
B. first target whose name starts with “.”
C. first target whose name does not starts with “.”
D. none of the mentioned
Answer: C

223. If we want to get the exit status that specified targets are up to date or
not, we have to execute the make command with option
A. -q
B. -r
C. -s
D. -t
Answer: A

224. Which make command option ignores all errors in commands executed to remark
files?
A. -i
B. -j
C. -k
D. -l
Answer: A

225. If we want to execute the makefile by just giving the “make” command, makefile
should be named as
A. Makefile
B. makefile
C. MAKEFILE
D. none of the mentioned
Answer: A

226. Which one of the following command can be used to provide executable
permissions for a file?
A. chmod +x
B. chmod 777
C. both (a) and (b)
D. none of the mentioned
Answer: C

227. The lines in our code that begin with the “#” character are
A. preprocessor directives
B. macros
C. header files
D. none of the mentioned
Answer: A
228. The result of an expression can be assigned to an environement variable with
the command
A. assign
B. set
C. env
D. none of the mentioned
Answer: B

You might also like