Shell Programming MCQs

By: Prof. Fazal Rehman Shamil

Shell Programming using read Command and Command Line Arguments
The positional parameters are______
(A). special variables and patterns
(B). pattern matching parameters
(C). special variables to read user input
(D). From the command lines, the special variables for assigning arguments
(E). None of these
MCQ Answer: d


The shell script is___
(A). File containing a series of commands
(B). File containing special symbols
(C). group of commands
(D). group of functions
(E). None of these
MCQ Answer: a


For storing the number of positional parameters, what is used?
(A). $n
(B). $*
(C). $#
(D). $2
(E). None of these
MCQ Answer: c


To make the scripts interactive, the ________ command is used.
(A). ip
(B). input
(C). write
(D). read
(E). None of these
MCQ Answer: d


The internal tool of a shell is the read command.
(A). False
(B). True
(E). None of these
MCQ Answer: b


With one or more variables single read statement is used.
(A). True
(B). False
(E). None of these
MCQ Answer: a


With an extension .sh the shell scripts are saved.
(A). False
(B). True
(E). None of these
MCQ Answer: a


In the separate child shell process, the shell script executes.
(A). True
(B). False
(E). None of these
MCQ Answer: a


With ____ first line of every shell script begins.
(A). &
(B). #
(C). $
(D). !
(E). None of these
MCQ Answer: b


By shell into the parameter, __ reads the first argument
(A). $1
(B). $3
(C). $$
(D). 1$
(E). None of these
MCQ Answer: a


In ____ as a single string, a complete set of the positional parameters is stored.
(A). $*
(B). $#
(C). $n
(D). $$
(E). None of these
MCQ Answer: a


We have to make it executable first by using ___, to run a script
(A). chmod +w
(B). chmod +r
(C). chmod +x
(D). chmod +rwx
(E). None of these
MCQ Answer: c


____command is used to spawn a child of our own choice for running a script.
(A). sh
(B). pr
(C). ps
(D). $$
(E). None of these
MCQ Answer: a


For looping with a list what is used?
(A). for
(B). until
(C). case
(D). while
(E). None of these
MCQ Answer: a


To shift arguments left we use ____ statement.
(A). set
(B). paste
(C). cut
(D). shift
(E). None of these
MCQ Answer: d


For reading data from the same file containing the script, _______allows us.
(A). >>
(B). —
(C). !!
(D). <<
(E). None of these
MCQ Answer: d


Any of the commands using standard input takes the input from here document.
(A). False
(B). True
(E). None of these
MCQ Answer: b


The loop is a while loop until the loop operates with reverse logic.
(A). False
(B). True
(E). None of these
MCQ Answer: b


The internal command in the following is_______
(A). set
(B). expr
(C). cut
(D). Is
(E). None of these
MCQ Answer: a


A filename is not accepted as an argument by which command?
(A). mailx
(B). ls
(C). paste
(D). cut
(E). None of these
MCQ Answer: a


do and the done keyword is used by which loop statements?
(A). for
(B). while
(C). for and while
(D). case
(E). None of these
MCQ Answer: c


with interactive programs, the here document can also be used.
(A). True
(B). False
(E). None of these
MCQ Answer: a


The program is interrupted by_________ command in appropriate way.
(A). kill
(B). SIGKILL
(C). trap
(D). INT
(E). None of these
MCQ Answer: c


To perform a set of instructions repeatedly, Which commands are used?
(A). for
(B). for, while, until
(C). until
(D). while
(E). None of these
MCQ Answer: b


To change filename extensions, which command do we use?
(A). chown
(B). rename
(C). rm
(D). basename
(E). None of these
MCQ Answer: d


To manipulate positional parameters the shell uses which command?
(A). cut
(B). set
(C). case
(D). paste
(E). None of these
MCQ Answer: b


In while loop which keywords are used?
(A). do and done
(B). done
(C). then
(D).do
(E). None of these
MCQ Answer: a


For command substitution, with the set command which of the following symbol is used?
(A). –
(B). ??
(C). —
(D). _
(E). None of these
MCQ Answer: c

Next Operating System MCQs

Computer Science Repeated MCQs Book Download

Prof. Fazal Rehman Shamil
Latest posts by Prof. Fazal Rehman Shamil (see all)