Master of Computer Applications Second Year: Unix Lab
Master of Computer Applications Second Year: Unix Lab
Master of Computer Applications Second Year: Unix Lab
Second Year
Unix Lab
1. Which of the following features of UNIX may be used for inter process communication?
A. Signals
B. Pipes
C. Semaphore
D. All of these
2. In a system, if 5 people are currently using the vi editor. then the number of corresponding
processes will be
A. 1
B. 5
C. 2
D. 0
4. dev/null
A. Is a file
B. Has write permission for all
C. Is the UNIX built-in dustbin
D. All of these
6: The permission bits of a file noname. can be set to _rws_ _x_ _x by the command.
A. chmod 711 noname
B. chmod go -rw noname
C. chmod 2711 noname
D. None of the above
8: If one doesn't want anyone else to read or write to a file named datfile, except through a
program in a file filex , then he may use
A. chmod u+s filex ; chmod go_rw datfile
B. chmod 4711 filex ; chmod go_rw datfile
C. chmod 4711 datfile ; chmod go_rw filex
D. Both (a) and (b)
9: Writing a C program that accepts input from keyboard, rather than from a file is advantageous
because
A. Keyboard is a file that is already open
B. It can be used in a pipe, if it writes to stdout
C. Both (a) and (b)
D. None of the above
10: Consider the following command that invokes the executable file a.out, with the following
command line arguments a .out God loves you argv( [1][2] )corresponds to the character
A. e
B. o
C. y
D. d
11: Which of the following string functions can be used to find the last occurrence of a given
character in a given string?
A. strncmp
B. strncpy
C. strchr
D. None of the above
13: The default permission bits of a file when it is created for the first time, is controlled by
A. chmod value
B. fmask value
C. umask value
D. none of the above
18: Files that store data in the same format as used in program are called
A. binary files
B. Source file
C. Text file
D. Core
19: To allow only one user to work with a particular file at a particular time, one has to use
A. Semaphore
B. Critical region
C. Locking
D. Dedicated mode
24: Which of the following file names can be found in more than one directoy?
A. passwd
B. bin
C. date
D. Both (a) and (b)
25: /bin
A. Is a bucket for storing information
B. Has files in binary code
C. is a directory
D. Both (b) and (c)
34. Which option of the kill command sends the given signal name to the specified process?
A. -l
B. -n
C. -s
D. -a
39. Which command wait for the specified process to complete and return the exit status?
A. sleep
B. wait
C. delay
D. stop
40. 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
41. In UNIX resources are shared by all the users, so UNIX is_____________ System.
A. multiuser
B. featureless
C. portable
D. multitasking
45. When scheduler submits process to the queue, process is said to be in ____________ state.
A. hold
B. submit
C. run
D. ready-to-run
51. Which command is used with vi editor to move the cursor one row up?
A. i
B. j
C. h
D. k
52. Which command is used with the vi editor to save file and remain in the editing mode?
A. :q
B. :q!
C. :w
D. :x
56. To get out of insert mode, press the _____ key, which will put you back into command mode.
A. Shift
B. Ctrl
C. Esc
D. Alt
57. Which command is used to copy all files having the string chap and any two characters after
that to the progs directory?
A. cp chap* progs
B. cp chap?? progs
C. cp chap[12] /progs/*.*
D. None of these
58. Which command can be used to display the contents of a file on the screen?
A. ls
B. grep
C. cat
D. cut
60. When the shell is used from a terminal it will issue a prompt before reading a command. By
default this prompt is _____.
A. >
B. $
C. &
D. #
61. The shell prompt when further input is needed, by default it is ______.
A. >
B. $
C. &
D. #
63. When you execute a script called test at $ prompt as $test hi hello then test will be stored in
_____ positional parameter.
A. $#
B. $*
C. $0
D. $1
64. Use of \ in removing meaning of any meta character placed after it is known as
_______________.
A. Escaping
B. Treating
C. Editing these
D. None o
65. Any command surrounded by backquote is executed by shell and its output is inserted in the
place it was found. This is known as _________________________.
A. Command replacement
B. Parsing
C. Command substitution
D. Command execution
66. ________ pathname uses the current directory as point of reference for the file.
A. Relative
B. Absolute
C. Both A and B
D. None of these
67. ________ commands are executed directly by the shell. These commands will not have a
separate process running for each.
A. External
B. Background
C. Internal
D. None of these
68. Which command is used to extract specific columns from the file?
A. cat
B. grep
C. cut
D. paste
69. In delimited file format, designated keyboard characters known as ___________ are used to
maintain the data's tabular organization.
A. delimiters
B. separator
C. partition
D. divider
73. _______command copies to output those lines in the input that match a specified pattern.
A. cut
B. paste
C. echo
D. grep
77. Which symbol will be used with grep command to match the pattern pat at the beginning of a
line?
A. ^pat
B. $pat
C. pat$
D. pat^
79: cat/dev/tty
A. Throws garbage onto the terminal 1.
B. Just echoes what you type. line by line
C. Terminates if one types control at the beginning of a line
D. Both (b) & (c)
84: Which of the following shell script's looping features does not recognize the break
command?
A. while
B. until
C. for
D. None of the above
86: The desirable features of a new shell script you write is that
A. It should take its input from stdin
B. It does some cleaning up operation, on termination
C. It should not accept command line arguments
D. Both (a) & (b)
87: Which of the following shell commands displays the contents of each of the command line
arguments one by one
A. cat $
B. cat "$@"
C. Both (a) & (b)
D. cat "$"
90: Which of the following options for the shell command test should be followed by the file
descriptor"'
A. r
B. d
C. The data type of all fields in all file
D. s
91: Which of the following displays the exit status of the last executed command?
A. echo $4
B. echo $$
C. echo $?
D. echo $!
92: Which of the following file names cannot be displayed if la ls* is run?
A. .x
B. ?x
C. Both (a) & (b)
D. hidden
93: Which of the following initiates the sequence of events that ultimately allows a user to
login?
A. clri
B. sync
C. login
D. init
Answer Keys:
1. D 2. B 3. D 4. D 5. D 6. D 7. D 8. D 9. C 10. D
11. C 12. A 13. C 14. C 15. D 16. D 17. D 18. A 19. C 20. D
21. D 22. A 23. B 24. D 25. D 26. D 27. A 28. C 29. D 30. D
31. D 32. A 33. A 34. S 35. B 36. B 37. C 38. A 39. B 40. B
41. A 42. C 43. B 44. A 45. B 46. C 47. A 48. D 49. B 50. A
51. D 52. C 53. A 54. B 55. A 56. C 57. B 58. C 59. D 60. B
61. A 62. D 63. C 64. A 65. C 66. A 67. C 68. C 69. A 70. A
71. A 72. C 73. D 74. A 75. B 76. C 77. A 78. B 79. D 80. A
81. D 82. D 83. D 84. D 85. D 86. D 87. C 88. D 89. D 90. C
91. C 92. C 93. D 94. C 95. D 96. A 97. D 98. D 99. D 100. D